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

Function _get_max_identity

imperative/python/megengine/xla/rules/reduction.py:24–32  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

22
23
24def _get_max_identity(dtype) -> np.ndarray:
25 if dtype == np.float32 or dtype == np.float64 or dtype == np.float16:
26 return np.array(-np.inf, dtype)
27 elif (
28 dtype == np.int32 or dtype == np.int64 or dtype == np.int16 or dtype == np.int8
29 ):
30 return np.array(np.iinfo(dtype).min, dtype)
31 else:
32 assert False, f"unsupported dtype for max: {dtype}"
33
34
35def _get_min_identity(dtype) -> np.ndarray:

Callers 1

maxpooling_gradFunction · 0.85

Calls 1

arrayMethod · 0.80

Tested by

no test coverage detected