You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many methods that expect a list or a tensor specifying a shape as argument. It is often the case that I want to pass an argument such as shape=[t1, v2] where t1 is a tensor with shape = TensorShape([]) and v2 is a value. This is currently not possible in many (maybe all) methods.
My current work around is the following.
1- convert v2 to a tensor t2 with tf.convert_to_tensor
2- use t1 = tf.expand_dims(0, t1) and t2 = tf.expand_dims(0, t2) to add a dimension of size 1 to the tensors
3- pass the argument as shape=tf.concat(0, [t1, t2])
Am I missing a simpler way to accomplish that? Is it a good idea to add a feature that allows passing mixture of tensors and values inside a list as argument?
Edit: I just found out that the method tf.pack allows lists with tensors and values as argument. But the method tf.truncated_normal for instance, doesn't allow.
I also realized that I can use tf.pack to replace the steps (1,2,3) above. But it still would be nice if all methods had the same behaviour.
The text was updated successfully, but these errors were encountered:
Agreed, I've wanted this too. There are some annoying obstacles, since in some places we automatically convert singleton tensors to lists and this feature would be backwards incompatible, but we've had some internal discussion about removing that magical (and fairly unidiomatic) list conversion. If we did that, we'd be able to add your automatic conversion, which would be great.
There are many methods that expect a list or a tensor specifying a shape as argument. It is often the case that I want to pass an argument such as shape=[t1, v2] where t1 is a tensor with shape = TensorShape([]) and v2 is a value. This is currently not possible in many (maybe all) methods.
My current work around is the following.
1- convert v2 to a tensor t2 with tf.convert_to_tensor
2- use t1 = tf.expand_dims(0, t1) and t2 = tf.expand_dims(0, t2) to add a dimension of size 1 to the tensors
3- pass the argument as shape=tf.concat(0, [t1, t2])
Am I missing a simpler way to accomplish that? Is it a good idea to add a feature that allows passing mixture of tensors and values inside a list as argument?
Edit: I just found out that the method tf.pack allows lists with tensors and values as argument. But the method tf.truncated_normal for instance, doesn't allow.
I also realized that I can use tf.pack to replace the steps (1,2,3) above. But it still would be nice if all methods had the same behaviour.
The text was updated successfully, but these errors were encountered: