25#include "neml2/tensors/user_tensors/UserFixedDimTensor.h"
26#include "neml2/base/Sequence.h"
30#define USERFIXEDDIMTENSOR_REGISTER(T) register_NEML2_object_alias(User##T, #T)
31FOR_ALL_FIXEDDIMTENSOR(USERFIXEDDIMTENSOR_REGISTER);
44 " from a vector values. The vector will be reshaped according to the specified batch shape.";
47 options.
set(
"values").doc() =
"Values in this (flattened) tensor";
50 options.
set(
"batch_shape").doc() =
"Batch shape";
62 if (
vals.size() ==
size_t(
this->base_storage()))
63 this->
index_put_({torch::indexing::Ellipsis},
flat.reshape(this->base_sizes()));
65 this->
index_put_({torch::indexing::Ellipsis},
flat.reshape(this->sizes()));
70 " must equal to either the base storage size ",
72 " or the total storage size ",
76#define USERFIXEDDIMTENSOR_INSTANTIATE_FIXEDDIMTENSOR(T) template class UserFixedDimTensor<T>
77FOR_ALL_FIXEDDIMTENSOR(USERFIXEDDIMTENSOR_INSTANTIATE_FIXEDDIMTENSOR);
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
const std::string & doc() const
A readonly reference to the option set's docstring.
Definition OptionSet.h:91
const T & get(const std::string &) const
Definition OptionSet.h:422
T & set(const std::string &)
Definition OptionSet.h:436
UserFixedDimTensor(const OptionSet &options)
Construct a new UserFixedDimTensor object.
Definition UserFixedDimTensor.cxx:56
static OptionSet expected_options()
Definition UserFixedDimTensor.cxx:35
Definition UserTensor.h:33
static OptionSet expected_options()
Definition UserTensor.cxx:30
TorchSize storage_size(TorchShapeRef shape)
The flattened storage size of a tensor with given shape.
Definition utils.cxx:32
std::string demangle(const char *name)
Definition parser_utils.cxx:46
Definition CrossRef.cxx:32
const torch::TensorOptions default_tensor_options()
Definition types.cxx:30
std::vector< TorchSize > TorchShape
Definition types.h:34
void neml_assert(bool assertion, Args &&... args)
Definition error.h:73