I'm trying to get expected_out
from input
.
input = [[2],[3],[3]]
expected_out = [2,3,3]
How to get the expected_out
from input
using TensorFlow.
I'm trying to get expected_out
from input
.
input = [[2],[3],[3]]
expected_out = [2,3,3]
How to get the expected_out
from input
using TensorFlow.
Use tf.squeeze:
import tensorflow as tf
input = tf.constant([[2], [3], [3]])
with tf.Session() as sess:
print(sess.run(tf.squeeze(input)))
In this case you want to remove single dimensional entries from a matrix. In both TensorFlow and Numpy, this operation is termed as
squeeze
.Here is the official documentation for TensorFlow -
tf.squeeze
. Quoting from the documentation,Hence to solve your issue, you can either pass
None
toaxis
, your default case, or pass1
. Here is what the code will look like,or,