Module Instantiation #
Constructors that instantiate scalar-objective definitions from semantic tensors or storage-first runtime initialization plans.
def
Runtime.Autograd.Model.Module.ObjectiveDef.instantiate
{α β : Type}
[TorchLean.Storage α]
[TorchLean.Storage β]
[Context α]
[Torch.TensorTransfer α]
{stateShapes inputShapes dataInputShapes : List Spec.Shape}
(d : ObjectiveDef β stateShapes inputShapes dataInputShapes)
(cast : Float → α)
(runtime : Config := { })
(initialState? : Option (TorchLean.TensorPack α stateShapes) := none)
:
Instantiate an ObjectiveDef under a runtime scalar and configuration.
An explicit initialState? is used directly, without a Float intermediate. Otherwise the model's
stored Float initializers are converted with cast.
runtime selects the device and arithmetic policy. Its default uses the standard
runtime settings.