MCPcopy Create free account
hub / github.com/geekcomputers/Python / forward

Method forward

ML/src/python/neuralforge/nn/modules.py:97–104  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

95 self.bias = nn.Parameter(torch.zeros(num_channels))
96
97 def forward(self, x):
98 N, C, H, W = x.shape
99 x = x.reshape(N, self.num_groups, C // self.num_groups, H, W)
100 mean = x.mean([2, 3, 4], keepdim=True)
101 var = x.var([2, 3, 4], keepdim=True)
102 x = (x - mean) / torch.sqrt(var + self.eps)
103 x = x.reshape(N, C, H, W)
104 return x * self.weight[None, :, None, None] + self.bias[None, :, None, None]
105
106class DropPath(nn.Module):
107 def __init__(self, drop_prob=0.0):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected