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

Function ones_

imperative/python/megengine/module/init.py:32–38  ·  view source on GitHub ↗

Fills the given ``tensor`` with the scalar value `1`. Args: tensor: tensor to be initialized.

(tensor: Tensor)

Source from the content-addressed store, hash-verified

30
31
32def ones_(tensor: Tensor) -> None:
33 """Fills the given ``tensor`` with the scalar value `1`.
34
35 Args:
36 tensor: tensor to be initialized.
37 """
38 fill_(tensor, 1)
39
40
41def uniform_(tensor: Tensor, a: float = 0.0, b: float = 1.0) -> None:

Callers 4

reset_parametersMethod · 0.85
reset_parametersMethod · 0.85
reset_parametersMethod · 0.85
reset_parametersMethod · 0.85

Calls 1

fill_Function · 0.85

Tested by

no test coverage detected