首页后端开发Pythonpytorch如何把二维变成一维

pytorch如何把二维变成一维

时间2023-06-05 08:00:01发布访客分类Python浏览901
导读:pytorch如何把二维变成一维?from PIL import Image#python3中image要从PIL中导入 import numpy as np def getTestImgArray(filename,imgHeight,i...

pytorch如何把二维变成一维?

from PIL import Image#python3中image要从PIL中导入 import numpy as np def getTestImgArray(filename,imgHeight,imgWidth): im = Image.open(filename) x_s = imgWidth y_s = imgHeight im_arr = im.resize((x_s, y_s), Image.ANTIALIAS) nm = im_arr.reshape((1, imgHeight*imgHeight)

) nm = nm.astype(np.float32) return nm

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: pytorch如何把二维变成一维
本文地址: https://pptw.com/jishu/62255.html
如何用Python程序编写九九乘法表 python打代码是不是要有数据

游客 回复需填写必要信息