以下作品:
import tensorflow as tf
a = tf.constant(1.0, shape=[3])
tf.map_fn(lambda x: x+1, a)
#output: [2.0, 2.0, 2.0]
Run Code Online (Sandbox Code Playgroud)
然而这并没有:
import tensorflow as tf
b = tf.constant(1.0)
tf.map_fn(lambda x: x+1, b)
#expected output: 2.0
Run Code Online (Sandbox Code Playgroud)
任何提示将不胜感激!