I want to convert TensorVariable to numpy array and try:
feature_vector = keras_model.get_layer(blob_name).output.numpy()
But get the error.
AttributeError: 'TensorVariable' object has no attribute 'numpy'
I also tried:
feature_vector = keras_model.get_layer(blob_name).output
init = tf.compat.v1.global_variables_initializer()
with tf.compat.v1.Session() as sess:
sess.run(init)
print(feature_vector.eval())
But get error
theano.gof.fg.MissingInputError: Input 0 of the graph (indices start from 0), used to compute Shape(/input_1), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
Thank you @Lau. Yes, I using theano as it turns out and fixed this error like this