25#include "neml2/misc/utils.h"
35 return std::accumulate(
shape.begin(),
shape.end(),
sz, std::multiplies<TorchSize>());
71 return std::move(
net);
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
TorchShape pad_append(TorchShapeRef s, TorchSize dim, TorchSize pad)
Pad shape s to dimension dim by appending sizes of pad.
Definition utils.cxx:47
TorchSize storage_size(TorchShapeRef shape)
The flattened storage size of a tensor with given shape.
Definition utils.cxx:32
std::string indentation(int level, int indent)
Definition utils.cxx:56
TorchShape pad_prepend(TorchShapeRef s, TorchSize dim, TorchSize pad)
Pad shape s to dimension dim by prepending sizes of pad.
Definition utils.cxx:39
Definition CrossRef.cxx:32
int64_t TorchSize
Definition types.h:35
std::vector< TorchSize > TorchShape
Definition types.h:36
torch::IntArrayRef TorchShapeRef
Definition types.h:37