300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > pytorch如何把二维变成一维 – python – 前端 python 数组添加

pytorch如何把二维变成一维 – python – 前端 python 数组添加

时间:2023-02-23 21:36:50

相关推荐

pytorch如何把二维变成一维 – python – 前端 python 数组添加

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。