MCPcopy Create free account
hub / github.com/dangf15/THLNet / __init__

Method __init__

utils.py:87–101  ·  view source on GitHub ↗
(self,
                 num_features,
                 affine=True,
                 eps=1e-5,
                 )

Source from the content-addressed store, hash-verified

85
86class InstantLayerNorm2d(nn.Module):
87 def __init__(self,
88 num_features,
89 affine=True,
90 eps=1e-5,
91 ):
92 super(InstantLayerNorm2d, self).__init__()
93 self.num_features = num_features
94 self.affine = affine
95 self.eps = eps
96 if affine:
97 self.gain = nn.Parameter(torch.ones(1, num_features, 1, 1), requires_grad=True)
98 self.bias = nn.Parameter(torch.zeros(1, num_features, 1, 1), requires_grad=True)
99 else:
100 self.gain = Variable(torch.ones(1, num_features, 1, 1), requires_grad=False)
101 self.bias = Variable(torch.zeros(1, num_features, 1, 1), requires_grad=False)
102
103 def forward(self, inpt):
104 # inpt: (B,C,T,F)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected