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

Method _get_table

imperative/python/megengine/module/vision.py:484–490  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

482 raise TypeError("The input parameter has a wrong type. ")
483
484 def _get_table(self, size):
485 shape = (size, 1)
486 alpha = self._get_parameter(self.alpha, shape)
487 table = arange(255).astype("float32")
488 table = broadcast_to(table, (size, 255))
489 table = 127 + mul((table - 127), alpha)
490 return clip(table, 0, 255)
491
492 def forward(self, inp: Tensor) -> Tensor:
493 if inp.dtype.name == "uint8":

Callers 1

forwardMethod · 0.95

Calls 6

_get_parameterMethod · 0.95
arangeFunction · 0.50
broadcast_toFunction · 0.50
mulFunction · 0.50
clipFunction · 0.50
astypeMethod · 0.45

Tested by

no test coverage detected