MCPcopy Create free account
hub / github.com/ASLP-lab/OSUM / init_weights

Method init_weights

OSUM/wenet/squeezeformer/convolution.py:102–119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

100 self.init_weights()
101
102 def init_weights(self):
103 pw_max = self.channels**-0.5
104 dw_max = self.kernel_size**-0.5
105 torch.nn.init.uniform_(self.pointwise_conv1.weight.data, -pw_max,
106 pw_max)
107 if self.bias:
108 torch.nn.init.uniform_(self.pointwise_conv1.bias.data, -pw_max,
109 pw_max)
110 torch.nn.init.uniform_(self.depthwise_conv.weight.data, -dw_max,
111 dw_max)
112 if self.bias:
113 torch.nn.init.uniform_(self.depthwise_conv.bias.data, -dw_max,
114 dw_max)
115 torch.nn.init.uniform_(self.pointwise_conv2.weight.data, -pw_max,
116 pw_max)
117 if self.bias:
118 torch.nn.init.uniform_(self.pointwise_conv2.bias.data, -pw_max,
119 pw_max)
120
121 def forward(
122 self,

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected