|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
cuTENSOR-based implementation of tensor permute. More...
#include <cutensor_permuteimpl.hpp>
Public Types | |
| using | DimsType = ColMajorDims< int64_t > |
| using | StridesType = ColMajorStrides< int64_t > |
| using | ModesType = std::vector< int32_t > |
Public Member Functions | |
Lifecycle | |
| cuTENSOR_PermuteImpl (ColMajorPerm perm) | |
Read-only Accessors (for testing) | |
| ColMajorPerm const & | perm () const noexcept |
| DimsType const & | input_dims () const noexcept |
| DimsType const & | output_dims () const noexcept |
| ModesType const & | input_modes () const noexcept |
| ModesType const & | output_modes () const noexcept |
| StridesType | input_strides () const |
| StridesType | output_strides () const |
Permute interface | |
| void | set_dims (DimsType input_dims) |
| Setup the dimensions. More... | |
| template<typename DataT > | |
| void | permute (El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
| Permute the tensor. More... | |
| template<typename DataT > | |
| void | inverse_permute (El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
| Apply the inverse permutation to the tensor. More... | |
Modifiers | |
| void | swap (cuTENSOR_PermuteImpl &other) |
Static Private Member Functions | |
| static std::vector< int32_t > | make_modes (size_t const ndims) |
| template<typename DataT > | |
| static std::string | get_desc_key (El::Matrix< DataT, El::Device::GPU > const &mat, DimsType const &dims) |
| template<typename DataT > | |
| static cutensorTensorDescriptor_t | get_descriptor (El::Matrix< DataT, El::Device::GPU > const &mat, DimsType const &dims) |
Private Attributes | |
| ColMajorPerm | m_perm |
| DimsType | m_input_dims |
| DimsType | m_output_dims |
| ModesType | m_input_modes |
| ModesType | m_output_modes |
Static Private Attributes | |
| static std::unordered_map< std::string, cutensorTensorDescriptor_t > | m_desc_map |
| Keep track of descriptors so we don't have to repeatedly rebuild them. More... | |
cuTENSOR-based implementation of tensor permute.
Because cuTENSOR is primarily column-major-centric (I actually prefer it, too, but that's neither here nor there), this caches as much as possible to avoid the annoying recomputation of dims, strides, etc.
Definition at line 55 of file cutensor_permuteimpl.hpp.
| using lbann::cuTENSOR_PermuteImpl::DimsType = ColMajorDims<int64_t> |
Definition at line 58 of file cutensor_permuteimpl.hpp.
| using lbann::cuTENSOR_PermuteImpl::ModesType = std::vector<int32_t> |
Definition at line 60 of file cutensor_permuteimpl.hpp.
| using lbann::cuTENSOR_PermuteImpl::StridesType = ColMajorStrides<int64_t> |
Definition at line 59 of file cutensor_permuteimpl.hpp.
|
inline |
|
staticprivate |
Definition at line 204 of file cutensor_permuteimpl.hpp.
|
staticprivate |
Definition at line 219 of file cutensor_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 163 of file cutensor_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 174 of file cutensor_permuteimpl.hpp.
|
inline |
| void lbann::cuTENSOR_PermuteImpl::inverse_permute | ( | El::Matrix< DataT, El::Device::GPU > const & | in, |
| El::Matrix< DataT, El::Device::GPU > & | out | ||
| ) | const |
Apply the inverse permutation to the tensor.
Applies the inverse permutation to the tensor represented by "in". In line with the rest of LBANN, the permutation is applied to each column, which is treated as a packed tensor with the dimensions stored in this object.
Definition at line 281 of file cutensor_permuteimpl.hpp.
|
inlinestaticprivate |
Definition at line 196 of file cutensor_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 168 of file cutensor_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 180 of file cutensor_permuteimpl.hpp.
|
inline |
|
inlinenoexcept |
Definition at line 158 of file cutensor_permuteimpl.hpp.
| void lbann::cuTENSOR_PermuteImpl::permute | ( | El::Matrix< DataT, El::Device::GPU > const & | in, |
| El::Matrix< DataT, El::Device::GPU > & | out | ||
| ) | const |
Permute the tensor.
Applies the permutation to the tensor represented by "in". In line with the rest of LBANN, the permutation is applied to each column, which is treated as a packed tensor with the dimensions stored in this object.
Definition at line 255 of file cutensor_permuteimpl.hpp.
|
inline |
Setup the dimensions.
Must be compatible with the provided perm vector.
Definition at line 248 of file cutensor_permuteimpl.hpp.
|
inline |
Definition at line 314 of file cutensor_permuteimpl.hpp.
|
inlinestaticprivate |
Keep track of descriptors so we don't have to repeatedly rebuild them.
Definition at line 130 of file cutensor_permuteimpl.hpp.
|
private |
Definition at line 144 of file cutensor_permuteimpl.hpp.
|
private |
Definition at line 146 of file cutensor_permuteimpl.hpp.
|
private |
Definition at line 145 of file cutensor_permuteimpl.hpp.
|
private |
Definition at line 147 of file cutensor_permuteimpl.hpp.
|
private |
Definition at line 143 of file cutensor_permuteimpl.hpp.