子层变量一旦设置为空后在赋值,就会抛出异常
Created by: chunyisong
paddle 1.6,子层变量一旦设置为空后在赋值,就会抛出异常
call last) in 36 labels = fluid.dygraph.to_variable(np.ones((10,1),dtype='int64')) 37 for epoch in range(3): ---> 38 out = model(inputs) 39 loss = fluid.layers.softmax_with_cross_entropy(out,label=labels) 40 avgLoss = fluid.layers.mean(loss) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py in call(self, *inputs, **kwargs) 176 parallel_helper._broadcast_parameters(self._parameters.values()) 177 --> 178 outputs = self.forward(*inputs, **kwargs) 179 self._built = True 180 return outputs in forward(self, inputs) 24 # self.conv2 = None 25 def forward(self,inputs): ---> 26 y = self.conv(inputs) 27 short = inputs 28 short = self.conv2(y) TypeError: 'NoneType' object is not callable