NEML2 1.4.0
Loading...
Searching...
No Matches
LabeledTensor3D Class Reference

A single-batched, logically 3D LabeledTensor. More...

Detailed Description

A single-batched, logically 3D LabeledTensor.

#include <LabeledTensor3D.h>

Inheritance diagram for LabeledTensor3D:

Public Member Functions

void accumulate (const LabeledTensor3D &other, bool recursive=true)
 
void fill (const LabeledTensor3D &other, bool recursive=true)
 
LabeledTensor3D chain (const LabeledTensor3D &other, const LabeledMatrix &dself, const LabeledMatrix &dother) const
 Second order chain rule product of two derivatives.
 
- Public Member Functions inherited from LabeledTensor< LabeledTensor3D, 3 >
 LabeledTensor ()=default
 Default constructor.
 
 LabeledTensor (const torch::Tensor &tensor, TorchSize batch_dim, const std::vector< const LabeledAxis * > &axes)
 Construct from a Tensor with batch dim and vector of LabeledAxis
 
 LabeledTensor (const BatchTensor &tensor, const std::vector< const LabeledAxis * > &axes)
 Construct from a BatchTensor with vector of LabeledAxis
 
 LabeledTensor (const LabeledTensor3D &other)
 Copy constructor.
 
void operator= (const LabeledTensor3D &other)
 Assignment operator.
 
 operator BatchTensor () const
 A potentially dangerous implicit conversion.
 
 operator torch::Tensor () const
 A potentially dangerous implicit conversion.
 
LabeledTensor3D clone (torch::MemoryFormat memory_format=torch::MemoryFormat::Contiguous) const
 Clone this LabeledTensor.
 
void copy_ (const T &other)
 Copy the value from another tensor.
 
LabeledTensor3D detach () const
 Return a copy without gradient graphs.
 
void detach_ ()
 Detach from gradient graphs.
 
void zero_ ()
 Zero out this tensor.
 
torch::TensorOptions options () const
 Get the tensor options.
 
TorchSize batch_dim () const
 Return the number of batch dimensions.
 
TorchSize base_dim () const
 Return the number of base dimensions.
 
TorchShapeRef batch_sizes () const
 Return the batch size.
 
TorchShapeRef base_sizes () const
 Return the base size.
 
const std::vector< const LabeledAxis * > & axes () const
 Get all the labeled axes.
 
const LabeledAxisaxis (TorchSize i=0) const
 Get a specific labeled axis.
 
TorchSlice slice_indices (S &&... names) const
 How to slice the tensor given the names on each axis.
 
TorchShapeRef storage_size () const
 The shape of the entire LabeledTensor.
 
TorchShape storage_size (S &&... names) const
 The shape of a sub-block specified by the names on each dimension.
 
BatchTensor operator() (S &&... names) const
 
LabeledTensor3D slice (TorchSize i, const std::string &name) const
 Slice the tensor on the given dimension by a single variable or sub-axis.
 
LabeledTensor3D block (S &&... names) const
 Get the sub-block labeled by the given sub-axis names.
 
LabeledTensor3D batch_index (TorchSlice indices) const
 Get a batch.
 
void batch_index_put (TorchSlice indices, const torch::Tensor &other)
 Set a index sliced on the batch dimensions to a value.
 
BatchTensor base_index (TorchSlice indices) const
 Return an index sliced on the batch dimensions.
 
void base_index_put (TorchSlice indices, const torch::Tensor &other)
 Set a index sliced on the batch dimensions to a value.
 
variable_type< T >::type get (S &&... names) const
 Get and interpret the view as an object.
 
variable_type< T >::type get_list (S &&... names) const
 Get and interpret the view as a list of objects.
 
void set (const BatchTensorBase< T > &value, S &&... names)
 Set and interpret the input as an object.
 
void set_list (const BatchTensorBase< T > &value, S &&... names)
 Set and interpret the input as a list of objects.
 
LabeledTensor3D operator- () const
 Negation.
 
LabeledTensor3D to (const torch::TensorOptions &options) const
 Change tensor options.
 
const BatchTensortensor () const
 
BatchTensortensor ()
 

Additional Inherited Members

- Static Public Member Functions inherited from LabeledTensor< LabeledTensor3D, 3 >
static LabeledTensor3D empty (TorchShapeRef batch_shape, const std::vector< const LabeledAxis * > &axes, const torch::TensorOptions &options=default_tensor_options())
 Setup new empty storage.
 
static LabeledTensor3D empty_like (const LabeledTensor3D &other)
 Setup new empty storage like another LabeledTensor.
 
static LabeledTensor3D zeros (TorchShapeRef batch_shape, const std::vector< const LabeledAxis * > &axes, const torch::TensorOptions &options=default_tensor_options())
 Setup new storage with zeros.
 
static LabeledTensor3D zeros_like (const LabeledTensor3D &other)
 Setup new storage with zeros like another LabeledTensor.
 
- Protected Attributes inherited from LabeledTensor< LabeledTensor3D, 3 >
BatchTensor _tensor
 The tensor.
 
std::vector< const LabeledAxis * > _axes
 The labeled axes of this tensor.
 

Member Function Documentation

◆ accumulate()

void accumulate ( const LabeledTensor3D & other,
bool recursive = true )

Add another tensor into this tensor. The item set of the other tensor must be a subset of this tensor's item set.

◆ chain()

LabeledTensor3D chain ( const LabeledTensor3D & other,
const LabeledMatrix & dself,
const LabeledMatrix & dother ) const

Second order chain rule product of two derivatives.

◆ fill()

void fill ( const LabeledTensor3D & other,
bool recursive = true )

Fill another tensor into this tensor. The item set of the other tensor must be a subset of this tensor's item set.