26#include "neml2/tensors/tensors.h"
41 virtual void to_(
const torch::TensorOptions &) = 0;
68 virtual void to_(
const torch::TensorOptions & options)
override { _value = _value.to(options); }
72 virtual operator Tensor()
const override {
return _value; }
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:56
The base class to allow us to set up a polymorphic container of Tensors. The concrete definitions wil...
Definition TensorValue.h:36
virtual ~TensorValueBase()=default
virtual void operator=(const Tensor &val)=0
assignment operator
virtual TensorType type() const =0
Tensor type.
virtual void requires_grad_(bool req=true)=0
Require grad.
virtual void to_(const torch::TensorOptions &)=0
Send the value to the target options.
Concrete definition of tensor value.
Definition TensorValue.h:59
virtual void to_(const torch::TensorOptions &options) override
Send the value to the target options.
Definition TensorValue.h:68
virtual void requires_grad_(bool req=true) override
Require grad.
Definition TensorValue.h:70
TensorValue(const T &value)
Definition TensorValue.h:63
T & value()
Definition TensorValue.h:78
virtual void operator=(const Tensor &val) override
assignment operator
Definition TensorValue.h:74
virtual TensorType type() const override
Tensor type.
Definition TensorValue.h:76
Definition CrossRef.cxx:30
TensorType
Definition tensors.h:57