I am using custom softmax
function. I am trying to use shape of tensor x
as an element of shape of new tensor of zeros. It can not be done since it is not int.
def custom_softmax(x):
sh = K.shape(x)
...
xc = K.zeros((sh[0] * 16 * 16, 1))
...
The next option I tried is with evaluation of tensor which should work but not.
def custom_softmax(x):
sh = K.shape(x)
sess = K.get_session()
...
xc = K.zeros((sh[0].eval(session=sess) * 16 * 16, 1))
...
It gives me error
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'image_part_input' with dtype float
which is completely not understandable since it reference the main network input to be incorrect. Network works when I hardcode values of shape in K.zeros
. Is there any other solution?