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

Function _normal

imperative/python/megengine/random/rng.py:112–126  ·  view source on GitHub ↗
(
    mean: float,
    std: float,
    size: Optional[Iterable[int]],
    seed: int,
    device: str,
    handle: int,
)

Source from the content-addressed store, hash-verified

110
111
112def _normal(
113 mean: float,
114 std: float,
115 size: Optional[Iterable[int]],
116 seed: int,
117 device: str,
118 handle: int,
119) -> Tensor:
120 if size is None:
121 size = (1,)
122 op = GaussianRNG(seed=seed, mean=mean, std=std, handle=handle, dtype="float32")
123 _ref = Tensor([], dtype="int32", device=device)
124 shape = utils.astensor1d(size, _ref, dtype="int32", device=device)
125 (output,) = apply(op, shape)
126 return output
127
128
129def _gamma(

Callers 1

normalMethod · 0.85

Calls 3

GaussianRNGClass · 0.85
TensorClass · 0.50
applyFunction · 0.50

Tested by

no test coverage detected