0

I want to change the shape/dimension of tensor. For example,

x = tf.constant([1, 2, 3])

Then I want to get y = tf.constant([1,1], [2,2], [3,3]).

How can I get the new y transformation?

I have run the code

y = tf.map_fn(lambda e : (e, e), x)

But error that occured :

ValueError: The two structures don't have the same nested structure.
abunickabhi
  • 558
  • 2
  • 9
  • 31

1 Answers1

2

Make sure you declare explicitally the types:

y = tf.map_fn(lambda e : (e, e), x, dtype=(tf.float32, tf.float32))
ibarrond
  • 6,617
  • 4
  • 26
  • 45