MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / NormedConv2d

Function NormedConv2d

roach/models/torch_util.py:18–26  ·  view source on GitHub ↗

nn.Conv2d but with normalized fan-in init

(*args, scale=1, **kwargs)

Source from the content-addressed store, hash-verified

16
17
18def NormedConv2d(*args, scale=1, **kwargs):
19 """
20 nn.Conv2d but with normalized fan-in init
21 """
22 out = nn.Conv2d(*args, **kwargs)
23 out.weight.data *= scale / out.weight.norm(dim=(1, 2, 3), p=2, keepdim=True)
24 if kwargs.get("bias", True):
25 out.bias.data *= 0
26 return out
27
28
29def intprod(xs):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected