Reputation: 3472
I am using fully connected layer. The parameters required are input, number of output nodes and the activation function. But the number of output nodes is a tensor value that depends on the value of a placeholder. The code is attached below.
I need the variable rate to be a placeholder because, I have to change its value during training.
rate = tf.placeholder(tf.float32, shape=(), name='code_rate')
num_out = tf.to_int32(1/rate)
enc_out = layers.fully_connected(input_to_fcnn, num_out, tf.nn.relu)
During initialisation since the tensors are not defined, I get this error
num_outputs type should be one of class 'int', got class 'tensorflow.python.framework.ops.Tensor'
Is there any workaround to this? Thanks in advance!
Upvotes: 3
Views: 95
Reputation: 1247
Fully connected layers are meant to be fixed in size, there is no workaround.
Changing the output size would create problems...
If increasing the size, how do you set the weights of the incoming and outgoing "connections"?
If decreasing, which weights do you throw away ?
Upvotes: 1