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 repeatedD
times.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
x
andy
length, butx
andy
are often equal. In such a case you could just pass3
to anExpandingArray<2>
and it would “expand” to{3, 3}
.Public Functions
-
inline ExpandingArray(std::initializer_list<T> list)¶
Constructs an
ExpandingArray
from aninitializer_list
.The extent of the length is checked against the
ExpandingArray
’s extent parameterD
at runtime.
-
inline ExpandingArray(std::vector<T> vec)¶
Constructs an
ExpandingArray
from anstd::vector
.The extent of the length is checked against the
ExpandingArray
’s extent parameterD
at runtime.
-
inline ExpandingArray(at::ArrayRef<T> values)¶
Constructs an
ExpandingArray
from anat::ArrayRef
.The extent of the length is checked against the
ExpandingArray
’s extent parameterD
at runtime.
-
inline ExpandingArray(T single_size)¶
Constructs an
ExpandingArray
from a single value, which is repeatedD
times (whereD
is the extent parameter of theExpandingArray
).
-
inline ExpandingArray(const std::array<T, D> &values)¶
Constructs an
ExpandingArray
from a correctly sizedstd::array
.
-
inline size_t size() const noexcept¶
Returns the extent of the
ExpandingArray
.
-
inline ExpandingArray(std::initializer_list<T> list)¶