NEML2 1.4.0
|
The wrapper (decorator) for cross-referencing unresolved values at parse time. More...
The wrapper (decorator) for cross-referencing unresolved values at parse time.
All tokens in the input files are essentially strings, and it is not always possible to represent all quantities as strings. For example, more sophisticated tensor manufacturing methods require inputs like batch size, device type, etc., and cannot be specified with a single string literal. In such scenarios, it is preferable to interpret the string literal as a "label" cross-referencing another object. This wrapper provides cross-referencing capabilities to most input file types. The object name is used as the label, and the object value is not resolved until implicit conversion occurs.
T | The final resolved type |
#include <CrossRef.h>
Public Member Functions | |
CrossRef ()=default | |
CrossRef (const std::string &raw) | |
CrossRef< T > & | operator= (const std::string &other) |
Assignment operator. | |
operator T () const | |
Implicit conversion operator. | |
bool | operator== (const CrossRef< T > &other) const |
Test equality. | |
const std::string & | raw () const |
Get the raw string literal. | |
operator torch::Tensor () const | |
operator Tensor () const | |
operator torch::Tensor () const | |
operator Tensor () const | |
Friends | |
std::stringstream & | operator>> (std::stringstream &in, CrossRef< T > &) |
Stream into a CrossRef (used by Parsers to extract input options) | |
Implicit conversion operator.
The underlying string is parsed and used to resolve the cross-reference. It is assumed that the cross-referenced object has already been manufactured at this point.
operator torch::Tensor | ( | ) | const |
operator torch::Tensor | ( | ) | const |
Assignment operator.
This simply assigns the string without parsing and resolving the cross-reference
Get the raw string literal.