打开微信,使用扫一扫进入页面后,点击右上角菜单,
点击“发送给朋友”或“分享到朋友圈”完成分享
请问这个错误是什么原因导致的呢?我现在是离线推理ResNet分类模型
net = torch.load(model_path, =) qconfig = {: , : , : , : , : } quantized_net = mlu_quantize.quantize_dynamic_mlu(net.float(), =qconfig, =, =) quantized_net = quantized_net.eval().float()
img = Image.open(filename) #img = img.to(ct.mlu_device()) image = img # not tensor img print("\nimage = ", image) image_list.append(img) # [N, C, H, W] img = data_transform(img) # # expand batch dimension img = torch.unsqueeze(img, dim=0) # 推理生成量化值 quantized_net(img) # 保存量化后的模型 torch.save(quantized_net.state_dict(), './weight_int8.pt') # img = img.to(ct.mlu_device()) # predict class # output = torch.squeeze(model(img.to(device))).cpu() output = quantized_net(img.to(ct.mlu_device()))
热门帖子
精华帖子