求助 卷积初始化报错
Created by: rationme
def CSRNet(input,label):
def conv_block(ipt, filter_list,pool_size = 2):
return fluid.nets.img_conv_group(
input=ipt,
pool_size=pool_size,
pool_stride=pool_size,
conv_num_filter=filter_list,
conv_filter_size=3,
conv_act='relu',
#conv_with_batchnorm=True,
#conv_batchnorm_drop_rate=dropouts,
pool_type='max')
frontend_conv1 = conv_block(input,[64,64])
启动时 会报错
ValueErrorTraceback (most recent call last)
<ipython-input-27-3d678422d9b0> in <module>()
----> 1 train(r'/home/aaa/net/save')
<ipython-input-26-c9bf5f97e705> in train(save_dirname)
10 y = fluid.layers.data(name='y', shape=[None, None, None, 1], dtype='float32')
11
---> 12 y_predict, l2_cost = CSRNet(x, y)
13 sgd_optimizer = fluid.optimizer.SGD(learning_rate=1e-5)
14
<ipython-input-25-ef2b957dd1f2> in CSRNet(input, label)
16
17
---> 18 frontend_conv1 = conv_block(input,[64,64])
19 frontend_conv2 = conv_block(frontend_conv1,[128,128])
20 frontend_conv3 = conv_block(frontend_conv2 ,[256, 256,256])
<ipython-input-25-ef2b957dd1f2> in conv_block(ipt, filter_list, pool_size)
13 #conv_with_batchnorm=True,
14 #conv_batchnorm_drop_rate=dropouts,
---> 15 pool_type='max')
16
17
/home/aaa/anaconda2/lib/python2.7/site-packages/paddle/fluid/nets.pyc in img_conv_group(input, conv_num_filter, pool_size, conv_padding, conv_filter_size, conv_act, param_attr, conv_with_batchnorm, conv_batchnorm_drop_rate, pool_stride, pool_type, use_cudnn, use_mkldnn)
96 act=local_conv_act,
97 use_cudnn=use_cudnn,
---> 98 use_mkldnn=use_mkldnn)
99
100 if conv_with_batchnorm[i]:
/home/aaa/anaconda2/lib/python2.7/site-packages/paddle/fluid/layers/nn.pyc in conv2d(input, num_filters, filter_size, stride, padding, dilation, groups, param_attr, bias_attr, use_cudnn, use_mkldnn, act, name)
1273 shape=filter_shape,
1274 dtype=dtype,
-> 1275 default_initializer=_get_default_param_initializer())
1276
1277 pre_bias = helper.create_tmp_variable(dtype)
/home/aaa/anaconda2/lib/python2.7/site-packages/paddle/fluid/layers/nn.pyc in _get_default_param_initializer()
1266
1267 def _get_default_param_initializer():
-> 1268 std = (2.0 / (filter_size[0]**2 * num_channels))**0.5
1269 return Normal(0.0, std, 0)
1270
ValueError: negative number cannot be raised to a fractional power