1 报错描述
1.1 系统环境
Hardware Environment(Ascend/GPU/CPU): GPU
Software Environment:
– MindSpore version (source or binary): 1.5.0
– Python version (e.g., Python 3.7.5): 3.7.6
– OS platform and distribution (e.g., Linux Ubuntu 16.04): Ubuntu 4.15.0-74-generic
– GCC/Compiler version (if compiled from source):
1.2 基本信息
1.2.1 脚本
训练脚本是通过构建GroupNorm单算子网络,对小批量输入计算分组归一化的例子。脚本如下:
01 context.set_context(mode=context.PYNATIVE_MODE, device_target="Ascend")
02 def get_x():
03 arr = np.random.randint(1,20,size=(1,4,16,16))
04 x = Tensor(arr, dtype = ms.float32)
05 return x
06
07 class GroupNormTest(nn.Cell):
08 def __init__(self):
09 super(GroupNormTest, self).__init__()
10 self.print = ops.Print()
11 self.norm1 = nn.GroupNorm(num_groups=4, num_channels=4,affine=**False**)
12
13 def construct(self, x):
14 self.print(self.norm1.gamma)
15 x = self.norm1(x)
16 return x
17
18 groupnorm_op = GroupNormTest()
19 g2 = nn.GroupNorm(num_groups=4, num_channels=4,affine=**False**)
20 x = get_x()
21 output = groupnorm_op(x)
22 print(f"输出结果:{
output}")
1.2.2 报错
由标杆算子知,预期输出的Tensor不应该全为0,这里打印结果如下:
输出结果: [[[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0.