Template Class ExpandingArray#
Defined in File expanding_array.h
Page Contents
Class Documentation#
-
template<size_t D, typename T = int64_t>
class ExpandingArray# A utility class that accepts either a container of
D-many values, or a single value, which is internally repeatedDtimes.This is useful to represent parameters that are multidimensional, but often equally sized in all dimensions. For example, the kernel size of a 2D convolution has an
xandylength, butxandyare often equal. In such a case you could just pass3to anExpandingArray<2>and it would “expand” to{3, 3}.Public Functions
-
inline ExpandingArray(std::initializer_list<T> list)#
Constructs an
ExpandingArrayfrom aninitializer_list.The extent of the length is checked against the
ExpandingArray’s extent parameterDat runtime.
-
inline ExpandingArray(std::vector<T> vec)#
Constructs an
ExpandingArrayfrom anstd::vector.The extent of the length is checked against the
ExpandingArray’s extent parameterDat runtime.
-
inline ExpandingArray(c10::ArrayRef<T> values)#
Constructs an
ExpandingArrayfrom anc10::ArrayRef.The extent of the length is checked against the
ExpandingArray’s extent parameterDat runtime.
-
inline ExpandingArray(T single_size)#
Constructs an
ExpandingArrayfrom a single value, which is repeatedDtimes (whereDis the extent parameter of theExpandingArray).
-
inline ExpandingArray(const std::array<T, D> &values)#
Constructs an
ExpandingArrayfrom a correctly sizedstd::array.
-
inline size_t size() const noexcept#
Returns the extent of the
ExpandingArray.
-
inline ExpandingArray(std::initializer_list<T> list)#