我正在尝试建立一个二值神经网络,但错误是 “模块'tensorlayer.layers'没有属性'flatten'”
tf.reset_default_graph()
x = tf.placeholder(tf.float32, [None, 1, 48, 1])
net = tl.layers.InputLayer(x, name='input')
net = tl.layers.BinaryConv2d(net, 32, (5, 5), (1, 1), padding='SAME', name='bcnn1')
net = tl.layers.MaxPool2d(net, (2, 2), (2, 2), padding='SAME', name='pool1')
net = tl.layers.BatchNormLayer(net, act=tl.act.htanh, is_train=True,name='bn1')
net = tl.layers.SignLayer(net)
net = tl.layers.BinaryConv2d(net, 64, (5, 5), (1, 1), padding='SAME', name='bcnn2')
net = tl.layers.MaxPool2d(net, (2, 2), (2, 2), padding='SAME', name='pool2')
net = tl.layers.BatchNormLayer(net, act=tl.act.htanh, is_train=True, name='bn2')
net = tl.layers.flatten(net)
net = tl.layers.DenseLayer(net, n_units=40, act = tf.identity, name='output_layer')