我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用torch.nn.InstanceNorm3d()。
def test_InstanceNorm3d(self): b = random.randint(3, 5) c = random.randint(1, 5) w = random.randint(2, 5) h = random.randint(2, 5) d = random.randint(2, 5) input = torch.Tensor(b, c, h, w, d).uniform_() self._test_InstanceNorm(nn.InstanceNorm3d, input)
def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=False): super(Module, self).__init__() if momentum is None: momentum = 0.1 self._instance_norm = InstanceNorm3d( num_features, eps=eps, momentum=momentum, affine=True )