template<class Derived, Size... S>
class neml2::PrimitiveTensor< Derived, S >
PrimitiveTensor inherits from TensorBase and additionally templates on the base shape.
- Template Parameters
-
|
| | PrimitiveTensor ()=default |
| | Special member functions.
|
| |
| | PrimitiveTensor (const ATensor &tensor, Size intmd_dim) |
| | Construct from an ATensor and infer dynamic shape.
|
| |
| | PrimitiveTensor (const ATensor &tensor, Size dynamic_dim, Size intmd_dim) |
| | Construct from an ATensor and extract dynamic shape given dynamic dimension.
|
| |
| | PrimitiveTensor (const ATensor &tensor, const TraceableTensorShape &dynamic_shape, Size intmd_dim) |
| | Construct from an ATensor given dynamic shape.
|
| |
| template<class Derived2 > |
| | PrimitiveTensor (const TensorBase< Derived2 > &tensor) |
| | Copy constructor.
|
| |
| | operator neml2::Tensor () const |
| | Implicit conversion to a Tensor (discards information on the fixed base shape)
|
| |
| template<typename... Args> |
| Scalar | operator() (Args... i) const |
| | Single-element accessor.
|
| |
| | TensorBase ()=default |
| | Default constructor.
|
| |
| | TensorBase (const ATensor &tensor, Size dynamic_dim, Size intmd_dim) |
| | Construct from an ATensor with given dynamic dimension.
|
| |
| | TensorBase (const ATensor &tensor, TraceableTensorShape dynamic_shape, Size intmd_dim) |
| | Construct from an ATensor with given dynamic shape.
|
| |
| template<class Derived2 > |
| | TensorBase (const TensorBase< Derived2 > &tensor) |
| | Copy constructor.
|
| |
| | TensorBase (double)=delete |
| |
| | TensorBase (float)=delete |
| |
| | TensorBase (int)=delete |
| |
| Derived | variable_data () const |
| | Variable data without function graph.
|
| |
| Derived | contiguous () const |
| |
| Derived | clone () const |
| | Clone (take ownership)
|
| |
| Derived | detach () const |
| | Discard function graph.
|
| |
| Derived | to (const TensorOptions &options) const |
| | Change tensor options.
|
| |
| Derived | operator- () const |
| | Negation.
|
| |
| Size | batch_dim () const |
| |
| Size | base_dim () const |
| |
| Size | dynamic_dim () const |
| |
| Size | static_dim () const |
| |
| Size | intmd_dim () const |
| |
| TraceableTensorShape | batch_sizes () const |
| |
| TensorShapeRef | base_sizes () const |
| |
| const TraceableTensorShape & | dynamic_sizes () const |
| |
| TensorShapeRef | static_sizes () const |
| |
| TensorShapeRef | intmd_sizes () const |
| |
| TraceableSize | batch_size (Size i) const |
| |
| Size | base_size (Size i) const |
| |
| const TraceableSize & | dynamic_size (Size i) const |
| |
| Size | static_size (Size i) const |
| |
| Size | intmd_size (Size i) const |
| |
| Derived | dynamic_index (indexing::TensorIndicesRef indices) const |
| |
| Derived | intmd_index (indexing::TensorIndicesRef indices) const |
| |
| neml2::Tensor | base_index (indexing::TensorIndicesRef indices) const |
| |
| Derived | dynamic_slice (Size d, const indexing::Slice &index) const |
| |
| Derived | intmd_slice (Size d, const indexing::Slice &index) const |
| |
| neml2::Tensor | base_slice (Size d, const indexing::Slice &index) const |
| |
| void | dynamic_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other) |
| |
| void | dynamic_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v) |
| |
| void | intmd_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other) |
| |
| void | intmd_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v) |
| |
| void | base_index_put_ (indexing::TensorIndicesRef indices, const ATensor &other) |
| |
| void | base_index_put_ (indexing::TensorIndicesRef indices, const CScalar &v) |
| |
| Derived | dynamic_expand (const TraceableTensorShape &shape) const |
| |
| Derived | intmd_expand (TensorShapeRef shape) const |
| |
| neml2::Tensor | base_expand (TensorShapeRef shape) const |
| |
| Derived | batch_expand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const |
| |
| neml2::Tensor | static_expand (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const |
| |
| Derived | dynamic_expand (const TraceableSize &size, Size d) const |
| |
| Derived | intmd_expand (Size size, Size d) const |
| |
| neml2::Tensor | base_expand (Size size, Size d) const |
| |
| Derived | dynamic_expand_as (const neml2::Tensor &other) const |
| |
| Derived | intmd_expand_as (const neml2::Tensor &other) const |
| |
| neml2::Tensor | base_expand_as (const neml2::Tensor &other) const |
| |
| Derived | batch_expand_as (const neml2::Tensor &other) const |
| |
| neml2::Tensor | static_expand_as (const neml2::Tensor &other) const |
| |
| Derived | dynamic_reshape (const TraceableTensorShape &shape) const |
| |
| Derived | intmd_reshape (TensorShapeRef shape) const |
| |
| neml2::Tensor | base_reshape (TensorShapeRef shape) const |
| |
| Derived | batch_reshape (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape) const |
| |
| neml2::Tensor | static_reshape (TensorShapeRef intmd_shape, TensorShapeRef base_shape) const |
| |
| Derived | dynamic_squeeze (Size d) const |
| |
| Derived | intmd_squeeze (Size d) const |
| |
| neml2::Tensor | base_squeeze (Size d) const |
| |
| Derived | dynamic_unsqueeze (Size d, Size n=1) const |
| |
| Derived | intmd_unsqueeze (Size d, Size n=1) const |
| |
| neml2::Tensor | base_unsqueeze (Size d, Size n=1) const |
| |
| Derived | dynamic_transpose (Size d1, Size d2) const |
| |
| Derived | intmd_transpose (Size d1, Size d2) const |
| |
| neml2::Tensor | base_transpose (Size d1, Size d2) const |
| |
| Derived | dynamic_movedim (Size old_dim, Size new_dim) const |
| |
| Derived | intmd_movedim (Size old_dim, Size new_dim) const |
| |
| neml2::Tensor | base_movedim (Size old_dim, Size new_dim) const |
| |
| Derived | dynamic_flatten () const |
| |
| Derived | intmd_flatten () const |
| |
| neml2::Tensor | base_flatten () const |
| |
| Derived | batch_flatten () const |
| | Flatten batch dimensions.
|
| |
| neml2::Tensor | static_flatten () const |
| | Flatten static dimensions.
|
| |
|
| static Derived | create (const TensorDataContainer &data, Size intmd_dim=0, const TensorOptions &options=default_tensor_options()) |
| | Arbitrary tensor from a nested container with inferred batch dimension.
|
| |
| static Derived | einsum (c10::string_view equation, TensorList tensors) |
| | Einstein summation along base dimensions.
|
| |
|
| static Derived | empty (const TensorOptions &options=default_tensor_options()) |
| |
| static Derived | empty (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options()) |
| |
|
| static Derived | zeros (const TensorOptions &options=default_tensor_options()) |
| |
| static Derived | zeros (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options()) |
| |
|
| static Derived | ones (const TensorOptions &options=default_tensor_options()) |
| |
| static Derived | ones (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape={}, const TensorOptions &options=default_tensor_options()) |
| |
|
| static Derived | full (const CScalar &init, const TensorOptions &options=default_tensor_options()) |
| |
| static Derived | full (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const CScalar &init, const TensorOptions &options=default_tensor_options()) |
| |
|
| static Derived | rand (const TensorOptions &options=default_tensor_options()) |
| |
| static Derived | rand (const TraceableTensorShape &dynamic_shape, TensorShapeRef intmd_shape, const TensorOptions &options=default_tensor_options()) |
| |
|
| template<typename... Args, typename = std::enable_if_t<(sizeof...(Args) == const_base_numel || sizeof...(Args) == const_base_numel + 1)>> |
| static Derived | fill (Args &&... args) |
| |
| static Derived | empty_like (const Derived &other) |
| |
| static Derived | zeros_like (const Derived &other) |
| | Zero tensor like another, i.e. same batch and base shapes, same tensor options, etc.
|
| |
| static Derived | ones_like (const Derived &other) |
| | Unit tensor like another, i.e. same batch and base shapes, same tensor options, etc.
|
| |
| static Derived | full_like (const Derived &other, const CScalar &init) |
| |
| static Derived | rand_like (const Derived &other) |
| |