I need to create a matrix in TensorFlow to store some values. The trick is the matrix has to support dynamic shape.
I am trying to do the same I would do in numpy:
myVar = tf.Variable(tf.zeros((x,y), validate_shape=False)
where x=(?)
and y=2
. But this does not work because zeros does not support 'partially known TensorShape', so, How should I do this in TensorFlow?
If you know the shape out of the session, this could help.
1) You could use
tf.fill(dims, value=0.0)
which works with dynamic shapes.2) You could use a placeholder for the variable dimension, like e.g.: