Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
168
def
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
max
Method · 0.45
min
Method · 0.45
round
Method · 0.45
Tested by
no test coverage detected