(
updates: NestedTensor, state: dict[str, Any], params: NestedOptParam
)
| 97 | return {k: v.init(params) for k, v in kwargs.items()} |
| 98 | |
| 99 | def update_fn( |
| 100 | updates: NestedTensor, state: dict[str, Any], params: NestedOptParam |
| 101 | ) -> tuple[NestedTensor, optax.EmptyState]: |
| 102 | new_state = {} |
| 103 | for k, v in kwargs.items(): |
| 104 | updates, new_state[k] = v.update(updates, state[k], params) |
| 105 | return updates, new_state |
| 106 | |
| 107 | def partition_fn(param_spec): |
| 108 | return {k: v.partition(param_spec) for k, v in kwargs.items()} |
no test coverage detected