neml2.user_tensors¶
Native [Tensors] block types.
Exposes PythonTensor (HIT
type = Python) for inline Python expressions and the CSV<Type>
family used by the verification test suite to load reference snapshots from
on-disk CSV files.
- class neml2.user_tensors.CSVSR2[source]¶
Bases:
_CSVTensorBaseLoad 6 columns from CSV as an
SR2with shape(N, 6).Column-name suffix order matches the C++
VTestTimeSeries<SR2>/ Mandel slot convention:var_xx, var_yy, var_zz, var_yz, var_xz, var_xy. Values are stacked verbatim –.vtestfiles declare Mandel convention so the on-disk columns already carry the sqrt(2) scaling on shear slots.
- class neml2.user_tensors.CSVScalar[source]¶
Bases:
_CSVTensorBaseLoad a single column from CSV as a
Scalarwith shape(N,).
- class neml2.user_tensors.CSVVec[source]¶
Bases:
_CSVTensorBaseLoad 3 columns from CSV as a
Vecwith shape(N, 3).
- class neml2.user_tensors.CSVWR2[source]¶
Bases:
_CSVTensorBaseLoad 3 columns from CSV as a
WR2(skew) with shape(N, 3).Column-name suffix order mirrors the C++
VTestTimeSeries<WR2>call:var_zy, var_xz, var_yx. WR2 has no Mandel scaling – values are stacked verbatim.
- class neml2.user_tensors.PythonTensor[source]¶
Bases:
objectTensor built from an inline Python expression.
The
exproption is evaluated in a namespace pre-populated withtorch, every public name fromneml2.types(Scalar,SR2,SSR4, free functions),math, andnp(numpy, if importable). Cross-references to other[Tensors]entries resolve by bare identifier: writingbaseis equivalent totensor('base'), which avoids HIT’s restriction on nested quotes.The expression’s value (
torch.Tensoror aTensorWrappersubclass) is returned verbatim; the call site (typicallyneml2.model.Model.declare_typed_parameter()mode 2) is responsible for wrapping a raw tensor into a typed wrapper if needed.- classmethod from_hit(node, factory)[source]¶
- Parameters:
node (nmhit.Node)
factory (_NativeInputFile)
- Return type:
Any
- hit = <neml2.schema.HitSchema object>¶