0
点赞
收藏
分享

微信扫一扫

tf.map_fn 代码实例

夏侯居坤叶叔尘 2022-07-27 阅读 62


input_tensor = tf.reshape(input_tensor, [-1]) # 转成1d的

input_tensor = tf.map_fn(lambda x: tf.cond(x > 0.0001, lambda: 1.0, lambda: 0.0),
input_tensor)

input_tensor = tf.reshape(input_tensor, [batch_size, the_origin_size]) # 再从1d转回来


举报

相关推荐

0 条评论