小编Ras*_*ner的帖子

张量流map_fn 上的单值张量

是否可以在具有单个值的张量上运行map_fn?

以下作品:

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)
  • 有可能吗?
  • 我究竟做错了什么?

任何提示将不胜感激!

python-3.x tensorflow

5
推荐指数
1
解决办法
2022
查看次数

标签 统计

python-3.x ×1

tensorflow ×1