MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / forward

Method forward

imperative/python/test/unit/core/test_function.py:170–173  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

168def test_ste():
169 class STE(Function):
170 def forward(self, x):
171 maxv, minv = x.max(), x.min()
172 scale = F.maximum(maxv, -minv) / 127
173 return F.round(x / scale) * scale
174
175 def backward(self, grad_y):
176 return grad_y

Callers

nothing calls this directly

Calls 3

maxMethod · 0.45
minMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected