Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Member Functions
torch::ExpandingArray< D, T > Class Template Reference

A utility class that accepts either a container of D-many values, or a single value, which is internally repeated D times. More...

#include <expanding_array.h>

Public Member Functions

 ExpandingArray (std::initializer_list< T > list)
 Constructs an ExpandingArray from an initializer_list. More...
 
 ExpandingArray (at::ArrayRef< T > values)
 Constructs an ExpandingArray from an initializer_list. More...
 
 ExpandingArray (T single_size)
 Constructs an ExpandingArray from a single value, which is repeated D times (where D is the extent parameter of the ExpandingArray). More...
 
 ExpandingArray (const std::array< T, D > &values)
 Constructs an ExpandingArray from a correctly sized std::array.
 
std::array< T, D > & operator* ()
 Accesses the underlying std::array.
 
const std::array< T, D > & operator* () const
 Accesses the underlying std::array.
 
std::array< T, D > * operator-> ()
 Accesses the underlying std::array.
 
const std::array< T, D > * operator-> () const
 Accesses the underlying std::array.
 
 operator at::ArrayRef< T > () const
 Returns an ArrayRef to the underlying std::array.
 
size_t size () const noexcept
 Returns the extent of the ExpandingArray.
 

Detailed Description

template<size_t D, typename T = int64_t>
class torch::ExpandingArray< D, T >

A utility class that accepts either a container of D-many values, or a single value, which is internally repeated D 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 and y length, but x and y are often equal. In such a case you could just pass 3 to an ExpandingArray<2> and it would "expand" to {3, 3}.

Definition at line 21 of file expanding_array.h.

Constructor & Destructor Documentation

template<size_t D, typename T = int64_t>
torch::ExpandingArray< D, T >::ExpandingArray ( std::initializer_list< T list)
inline

Constructs an ExpandingArray from an initializer_list.

The extent of the length is checked against the ExpandingArray's extent parameter D at runtime.

Definition at line 26 of file expanding_array.h.

template<size_t D, typename T = int64_t>
torch::ExpandingArray< D, T >::ExpandingArray ( at::ArrayRef< T values)
inline

Constructs an ExpandingArray from an initializer_list.

The extent of the length is checked against the ExpandingArray's extent parameter D at runtime.

Definition at line 32 of file expanding_array.h.

template<size_t D, typename T = int64_t>
torch::ExpandingArray< D, T >::ExpandingArray ( T  single_size)
inline

Constructs an ExpandingArray from a single value, which is repeated D times (where D is the extent parameter of the ExpandingArray).

Definition at line 43 of file expanding_array.h.


The documentation for this class was generated from the following file: