转自: https://blog.csdn.net/jacke121/article/details/78833922

has invalid type <class 'numpy.ndarray'>, must be a string or Tensor. (Can not convert a ndarray into a Tensor or Operation.)

原因:变量命名重复了

image_test, label_test = get_batch(x_val, y_val, w, h, batch_size, CAPACITY)
img_test, label_test = sess.run([image_test, label_test])

解决方法:把任意一个变量名改了就好了

has invalid type <class 'numpy.ndarray'>, must be a string or Tensor的更多相关文章

  1. TypeError: Fetch argument 0.484375 has invalid type <class 'numpy.float32'>, must be a string or Tensor. (Can not convert a float32 into a Tensor or Operation.)

    报错: TypeError: Fetch argument 0.484375 has invalid type <class 'numpy.float32'>, must be a str ...

  2. 解决Tensorflow ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray)

    问题描述 在将一个数组送入tensorflow训练时,报错如下: ValueError: Failed to convert a NumPy array to a Tensor (Unsupporte ...

  3. Python中Numpy ndarray的使用

    本文主讲Python中Numpy数组的类型.全0全1数组的生成.随机数组.数组操作.矩阵的简单运算.矩阵的数学运算. 尽管可以用python中list嵌套来模拟矩阵,但使用Numpy库更方便. 定义数 ...

  4. torch.Tensor和numpy.ndarray

    1. torch.Tensor和numpy.ndarray相互转换 import torch import numpy as np # <class 'numpy.ndarray'> np ...

  5. python:<class 'numpy.ndarray'>的学习

    在学习opencv-python的时候,给出图片地址再调用cv2.imread("地址"),发现出创建的是numpy类型的ndarray对象,用来存放多维数组的对象 # 导入cv2 ...

  6. Lesson2——NumPy Ndarray 对象

    NumPy 教程目录 NumPy Ndarray 对象 NumPy 最重要的一个特点是其 $N$ 维数组对象 ndarray,它是一系列同类型数据的集合,以 $0$ 下标为开始进行集合中元素的索引. ...

  7. java.io.StreamCorruptedException: invalid type code: AC错误的解决方法

    问题描述: 在向一个文件写入可序列化对象时,每次只想向文件的末尾添加一个可序列化的对象,于是使用了FileOutputStream(文件名,true)间接的构建了ObjectOutputStream流 ...

  8. TypeError: Fetch argument 0 has invalid type <type 'int'>, must be a string or Tensor. (Can not convert a int into a Tensor or Operation.)

    6月5日的時候,修改dilated_seg.py(使用tensorflow)出現了報錯: TypeError: Fetch argument 0 has invalid type <type ' ...

  9. python中numpy.ndarray.shape的用法

    今天用到了shape,就顺便学习一下,这个shape的作用就是要把矩阵进行行列转换,请看下面的几个例子就明白了: >>> import numpy as np >>> ...

随机推荐

  1. face detection[DSFD]

    本文来自<DSFD: Dual Shot Face Detector>,时间线为2018年10月,是南理工Jian Li在腾讯优图实验室实习时候的作品.在WIDER FACE,FDDB上效 ...

  2. JVM调优常用参数和注意点备忘录

    本文主要是工作过程中总结的一些jvm调优的参数和注意的地方,作为一个备忘录,先占个坑,有时间在来细化具体的实例. gc日志是覆盖的方式如果文件名字固定会导致上一次被覆盖可以采用这个-Xloggc:ba ...

  3. [Spark][Python][Application]非交互式运行Spark Application 的例子

    非交互式运行Spark Application 的例子 $ cat Count.py import sys from pyspark import SparkContext if __name__ = ...

  4. .Net业务搭配实用技术栈

    前言 昨天有篇文章在讨论webform的设计思路,我已经四五年不用webform了,虽然它也提供了HttpModule和httphandle来处理请求,提供了一般处理程序ashx来简化处理流程,但依然 ...

  5. C# Type.GetType 返回NULL 问题解决记录

    Type.GetType("OP.Client.Html.Resources.KenFengFormMethod"); 从Dll里面获取KenFengFormMethod这个会返回 ...

  6. WebClient, HttpClient, HttpWebRequest ,RestSharp之间的区别与抉择

    NETCore提供了三种不同类型用于生产的REST API: HttpWebRequest;WebClient;HttpClient,开源社区创建了另一个名为RestSharp的库.如此多的http库 ...

  7. Python全栈开发之路 【第六篇】:Python基础之常用模块

    本节内容 模块分类: 好处: 标准库: help("modules") 查看所有python自带模块列表 第三方开源模块: 自定义模块: 模块调用: import module f ...

  8. Leetcode 153. Find Minimum in Rotated Sorted Array -- 二分查找的变种

    Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e. ...

  9. Python-Django下载与基本命令

    1.下载Django: pip3 install django 2.创建一个django project django-admin.py startproject mysite 当前目录下会生成mys ...

  10. Python学习之赋值列表

    # the program aim to differentiate the defference of a=b or a=b[:] my_fruits=["apple",&quo ...