MCPcopy
hub / github.com/EleutherAI/gpt-neox / make_sparse

Method make_sparse

megatron/optimizers.py:91–95  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

89
90 # Transform update_values into sparse tensor
91 def make_sparse(values):
92 constructor = grad.new
93 if grad_indices.dim() == 0 or values.dim() == 0:
94 return constructor().resize_as_(grad)
95 return constructor(grad_indices, values, grad.size())
96
97 acc = state[_key(0)]
98 update_values = _compute_sparse_update(

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected