int make_state_scalar(double value, Dtype dtype)Build a zero-dimensional CPU tensor holding one scalar of optimizer state.
Per-parameter scalars — the step counter every adaptive optimizer
keeps, NAdam's running momentum product — travel through
state_buffers as 0-d tensors, the shape the reference framework
gives them. They live on the CPU whatever the parameter's device,
as the reference framework's do.
See Also
read_state_scalar : the inverse.
Parameters
valuedoubleValue to store, converted to
dtype.dtypeDtypeElement type of the returned tensor.
Returns
std::shared_ptr<TensorImpl>A 0-d CPU tensor that owns its buffer.