MCPcopy Create free account
hub / github.com/apple/axlearn / update_fn

Function update_fn

axlearn/common/optimizers.py:99–105  ·  view source on GitHub ↗
(
        updates: NestedTensor, state: dict[str, Any], params: NestedOptParam
    )

Source from the content-addressed store, hash-verified

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()}

Callers 1

update_kv_pagesMethod · 0.50

Calls 15

current_contextFunction · 0.90
vectorized_tree_mapFunction · 0.90
maybe_instantiateFunction · 0.90
opt_param_valuesFunction · 0.85
_weight_decay_scalesFunction · 0.85
fFunction · 0.85
_is_valid_stepFunction · 0.85
_momentFunction · 0.85
_stddevFunction · 0.85
SkipClipStateClass · 0.85

Tested by

no test coverage detected