[work]Cannot convert a partially converted tensor in TensorFlow

2人阅读 评论(0) 收藏 举报
分类:

Keras Tensor 操作的时候,第一维度是“?”,所以特殊处理,让其batchsize可变


You just need to feed it in as a single example but in the batched shape. So that means adding an extra dimension to the shape e.g.

batch_size = 32 # set this to the actual size of your batch
tf.truncated_normal((batch_size, 784), mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)

This way it will "fit" into the placeholder.

If you expect batch_size to change you can also use:

tf.truncated_normal(tf.shape(input_tensor), mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)

Where input_tensor could be a placeholder or just whatever tensor is going to have this noise added to it.

查看评论

TypeError: Cannot convert Type TensorType(float32, matrix).....

TypeError: Cannot convert Type TensorType(float32, matrix)…..最下面链接给的错误是cannot conver… 64 to 32,解决方案是...
  • m0_37052320
  • m0_37052320
  • 2017-11-07 09:04:28
  • 392

Cannot interpret feed_dict key as Tensor: Can not convert a method into a Tensor.

代码: input1 = tf.placeholder(tf.types.float32) input2 = tf.placeholder(tf.types.float32) output = tf....
  • zhongxinleishi
  • zhongxinleishi
  • 2017-08-21 13:36:02
  • 1640

TensorFlow 遇到的问题(三)

关键字:TypeError: Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor 解释:你...
  • ice_pill
  • ice_pill
  • 2017-11-18 11:59:41
  • 941

SSD-Tensorflow:TypeError: Can not convert a tuple into a Tensor or Operation

我在用这个模型进行评估的时候,遇见了上述这个问题,直接用github上的命令是有问题的,我的环境是python3, tensorflow 1.4,ubuntu16.04,结果就报错了: TypeEr...
  • w5688414
  • w5688414
  • 2017-11-14 14:08:01
  • 606

TypeError: Can not convert a float32 into a Tensor or Operation.

错误TypeError: Can not convert a float32 into a Tensor or Operation. # 类型错误:不能将一个浮动32转换为一个张量或操作。TypeEr...
  • FontThrone
  • FontThrone
  • 2017-08-09 21:03:55
  • 3050

TensorFlow的图像预处理报错ValueError: Tried to convert ‘min_object_covered’ to a tensor and failed.

错误行: bbox_begin, bbox_size, _ = tf.image.sample_distorted_bounding_box ( tf.shape (image), bo...
  • ChenVast
  • ChenVast
  • 2017-12-09 14:19:58
  • 342

第一个tensorflow小程序——异或门实现

代码:#author@chengxiaona import tensorflow as tf import numpy as np#输入训练数据,这里是python的list, 也可以定义为numpy...
  • chengxiaona
  • chengxiaona
  • 2017-10-15 16:32:25
  • 889

Tensorflow踩坑记

这里是踩坑纪录,大家如果想看教程的话请出门右转~从前有个小孩,正在学习TF,一开始,写了个逻辑回归的优化程序:import tensorflow as tf import numpy as npx=t...
  • hejunqing14
  • hejunqing14
  • 2016-09-28 15:38:27
  • 10174

python学习中遇到问题

python
  • nogod2015
  • nogod2015
  • 2016-01-22 14:20:50
  • 2278

TensorFlow调试常见问题(pycharm)

1. RuntimeError: Attempted to use a closed Session. 在pycharm下调用tensorflow库时,运行出现以下问题: RuntimeErro...
  • jiaoyangwm
  • jiaoyangwm
  • 2018-02-08 19:46:35
  • 705
    友情链接
    个人资料
    专栏达人 持之以恒
    等级:
    访问量: 117万+
    积分: 1万+
    排名: 768
    博客专栏
    最新评论