Suppose I have two tensor variables each of size 2x4:
v1 = tf.logical_and(a1, b1)v2 = tf.logical_and(a2, b2)Instead, I want to store these in an array calledv which is of size 2x2x4. How do I do this in Tensorflow? The idea would be something like this:
for i in range(2): v[i] = tf.logical_and(a[i],b[i])How do I initializev? I tried initializingv as a numpy array which did not work. I also tried initializing it as a tensorflow variable, ie.tf.Variable(tf.zeros([2])) but that does not work either.
Note,a andb are dynamic inputs, ie. they aretf.placeholder variables.
2 Answers2
tf.pack() is probably what you are looking for.
As a potentially relevant update,in TensorFlow 1.0tf.pack() was renamed totf.stack().
Comments
Explore related questions
See similar questions with these tags.
