core.HasTemplate
core.HasTemplate()A Curvature or Staged method that knows its result’s structure before any data.
It reads no data, so checks that need only the structure (does a prior fit the curvature?) can run on it before the data pass.
A template is a real operator, so it costs what the result costs: a Dense template holds \(P^2\) zeros, and adding a prior to it touches every one (about 0.1 s at 9,802 weights in float32).
Methods
| Name | Description |
|---|---|
| template | A zero operator shaped like the result. |
template
core.HasTemplate.template(params, ctx, /)A zero operator shaped like the result.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| params | Params | The params the curvature is taken at. | required |
| ctx | FitContext | The fit’s context. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Operator[Any] | A zero operator with exactly the structure finalize (or the last pass) returns: the same operator types, blocks, static fields, leaf shapes and dtypes, with KronEigenbasis.factors present as zeros when finalize sets them. |