pythonvalueerror参数_ValueError:参数必须是密集张量–Python和TensorFlow

我正在提取可能与我遇到的问题相关的代码的一些部分:

from PIL import Image

import tensorflow as tf

data = Image.open('1-enhanced.png')

...

...

raw_data = data

raw_img = raw_data

我收到以下长消息,我不确定如何分析(你对这里发生了什么有任何想法):

Traceback (most recent call last):

File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py",line 490,in apply_op

preferred_dtype=default_dtype)

File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py",line 669,in convert_to_tensor

ret = conversion_func(value,dtype=dtype,name=name,as_ref=as_ref)

File "C:\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py",line 176,in _constant_tensor_conversion_function

return constant(v,name=name)

File "C:\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py",line 165,in constant

tensor_util.make_tensor_proto(value,shape=shape,verify_shape=verify_shape))

File "C:\Python35\lib\site-packages\tensorflow\python\framework\tensor_util.py",line 376,in make_tensor_proto

_GetDenseDimensions(values)))

ValueError: Argument must be a dense tensor: - got shape [150,150],but wanted [].

During handling of the above exception,another exception occurred:

Traceback (most recent call last):

File "conv_visuals.py",line 54,in

x = tf.reshape(raw_data,shape=[-1,150,1])

File "C:\Python35\lib\site-packages\tensorflow\python\ops\gen_array_ops.py",line 2448,in reshape

name=name)

File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py",line 503,in apply_op

as_ref=input_arg.is_ref).dtype.name

File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py",but wanted [].

谢谢.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值