Reputation: 271
I am trying to build a binarised neural network but error is "module 'tensorlayer.layers' has no attribute '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')
Upvotes: 0
Views: 443
Reputation: 27060
There's not flatten
attribute. You're looking for the FlattenLayer
attribute:
net = tl.layers.FlattenLayer(net)
Upvotes: 1