MCPcopy Index your code
hub / github.com/apache/tvm / batch_norm

Function batch_norm

python/tvm/topi/testing/batch_norm.py:22–115  ·  view source on GitHub ↗

Batch Normalization operator implemented in Numpy. Parameters ---------- data : np.ndarray Input to be batch-normalized. gamma : np.ndarray Scale factor to be applied to the normalized tensor. beta : np.ndarray Offset to be applied to the normalized ten

(
    x: np.ndarray,
    gamma: np.ndarray,
    beta: np.ndarray,
    moving_mean: np.ndarray,
    moving_var: np.ndarray,
    axis: int,
    epsilon: float,
    center: bool,
    scale: bool,
    training: bool,
    momentum: float,
)

Source from the content-addressed store, hash-verified

20
21
22def batch_norm(
23 x: np.ndarray,
24 gamma: np.ndarray,
25 beta: np.ndarray,
26 moving_mean: np.ndarray,
27 moving_var: np.ndarray,
28 axis: int,
29 epsilon: float,
30 center: bool,
31 scale: bool,
32 training: bool,
33 momentum: float,
34):
35 """Batch Normalization operator implemented in Numpy.
36
37 Parameters
38 ----------
39 data : np.ndarray
40 Input to be batch-normalized.
41
42 gamma : np.ndarray
43 Scale factor to be applied to the normalized tensor.
44
45 beta : np.ndarray
46 Offset to be applied to the normalized tensor.
47
48 moving_mean : np.ndarray
49 Running mean of input.
50
51 moving_var : np.ndarray
52 Running variance of input.
53
54 axis : int
55 Specify along which shape axis the normalization should occur.
56
57 epsilon : float
58 Small float added to variance to avoid dividing by zero.
59
60 center : bool
61 If True, add offset of beta to normalized tensor, If False,
62 beta is ignored.
63
64 scale : bool
65 If True, scale normalized tensor by gamma. If False, gamma
66 is ignored.
67
68 training : bool
69 Indicating whether it is in training mode. If True, update
70 moving_mean and moving_var.
71
72 momentum : float
73 The value used for the moving_mean and moving_var update
74
75 Returns
76 -------
77 output : np.ndarray
78 Normalized data with same shape as input
79

Callers

nothing calls this directly

Calls 4

tupleFunction · 0.85
meanMethod · 0.80
removeMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…