因为Tensor类型的数据不可以直接format,需要使用 item() 属性或者是 tolist() 属性。要获取下标可以用 emurate()
代码:

for index,(xb,yb)in enumerate(trainloader):pred = net(xb)loss=loss_func(pred,yb)accu=accuracy(pred,yb)print("Train Epoch:",epoch,'\t',"[{:d}/{:d} ({:.0%})] ".format(index,bs_train,index/bs_train),'Loss:{:f}'.format(loss.item()))

unsupported format string passed to Tensor.__format__相关推荐

  1. TypeError: unsupported format string passed to NoneType.__format__

    Traceback (most recent call last):File "C:/Users/Lenovo/PycharmProjects/untitled3/text6.py" ...

  2. ValueError: unsupported format character ‘j‘ (0x6a) at index 4

    setattr(self, 'res%j' % j, res) 报错, ValueError: unsupported format character 'j' (0x6a) at index 4 出 ...

  3. Unsupported format or combination of formats) Failed to parse onnx model

    Unsupported format or combination of formats) Failed to parse onnx model 加载模型时报错: cv2.dnn.readNetFro ...

  4. 成功解决xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b‘Debug is

    成功解决xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'Debug is ...

  5. 成功解决ValueError: Invalid format string

    成功解决ValueError: Invalid format string 目录 解决问题 解决思路 解决方法 解决问题 ValueError: Invalid format string 解决思路 ...

  6. python向数据库传输数据时弹出not enough arguments for format string怎么办

    cursor.executemany 为批量操作,批量就是一次能写入多行数据 传入cursor.executemany(sql, values)的values参数,应是多行的,即 [(一组数据),(另 ...

  7. 解决python中TypeError: not enough arguments for format string

    解决python中TypeError: not enough arguments for format string for i in range(1,10):​ for j in range(1,i ...

  8. Python 错误:ValueError: unsupported format character ‘Y‘ (0x59) at index 146

    转载文章如下:https://www.cnblogs.com/wlios/p/7553005.html 今天对于根据datetime的一个字段来查询相关数据时,报了一个错误信息,具体信息,原因,解决方 ...

  9. OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and out

    OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and out ...

最新文章

  1. Xstream util xml 与 bean之间互转
  2. linux cat命令源码,每天一个linux命令:cat 命令
  3. acl 日志记录方式介绍
  4. Redhat Linux 防火墙
  5. java basic类似的地方_java – Shiro使用HTTP Basic Auth或匿名访问相同的URI
  6. [20180428]DNS与ORA-12154错误.txt
  7. P2626 斐波那契数列(升级版)
  8. 家里宽带628连不上_WiFi密码正确,别人正常但是自己的手机却连不上WiFi是怎么回事?...
  9. ArcGIS 视域分析
  10. [Hive]-Table
  11. 网站并发cpu占用率_来,控制一下 goroutine 的并发数量
  12. flutter-可拖动悬浮按钮
  13. 小马哥-----高仿苹果6 plus刷机 详细拆机主板图与开机界面图与移植触摸屏版中文rec 界面 多图展示
  14. 频繁发送socket命令返回:[WinError 10054] 远程主机强迫关闭了一个现有的连接
  15. 面试题16:不含重复字符的最长子字符串(Java版)
  16. MATLAB---形态学滤波
  17. js去掉头尾空格、括号
  18. NetBIOS 漏洞的入侵与防御
  19. Hadoop(yarn)集群安装
  20. 共享计算机型n4中n代表什么,n代表什么(n代表的所有含义)

热门文章

  1. secureCRT SFTP会话常见命令
  2. C/S 界面设计规范
  3. unity入门——实现一个简单的跑酷游戏(人物控制)
  4. unity游戏开发之[英雄联盟]的美女设计师:Katie De Sousa
  5. 安兔兔苹果html5排行榜,跑分最高的苹果手机iOS设备性能排行榜
  6. PHP实现文件下载的两种方式(GuzzleHttp和Curl)
  7. 自媒体营销软文灵感思路来源——万能公式:6P方法论
  8. 联想模拟器可以卸载吗_联想模拟器可以卸载吗
  9. Xshell远程服务器后Tensorboard的本地可视化方法
  10. 用Python扒出B站那些“惊为天人”的阿婆主!