x = torch.stack([torch.from_numpy(fi) for fi in framed_imgs], 0) 这条语句里的framed_imgs由preprocess()生成,但preprocess()是从utils导入的,因此,即使去除了utils的依赖,我还是无法复现您的报错情况。另外,您这边想使用单步调试的原因是?与http://forum.cambricon.com/show-33-1178-1-6.html 这个帖子的需求是一致的吗?展开
x = torch.stack([torch.from_numpy(fi) for fi in framed_imgs], 0) 这条语句里的framed_imgs由preprocess()生成,但preprocess()是从utils导入的,因此,即使去除了utils的依赖,我还是无法复现您的报错情况。另外,您这边想使用单步调试的原因是?与http://forum.cambricon.com/show-33-1178-1-6.html 这个帖子的需求是一致的吗?展开
好的,谢谢您的解答,我那些导入的utils等文件没用到,贴代码的时候我忘记删了,很多导入的都用不到,我就是随便找个了图片测试了一下这个slice的功能,您复现的时候把报错的语句删掉应该就没问题了展开
import torch from torch.backends import cudnn from backbone import EfficientDetBackbone import cv2 import matplotlib #matplotlib.use('tkAgg') import matplotlib.pyplot as plt import numpy as np from efficientdet.utils import BBoxTransform, ClipBoxes from utils.utils import preprocess, invert_affine, postprocess import torch_mlu import torch_mlu.core.mlu_model as ct import torch_mlu.core.mlu_quantize as mlu_quantize import torchvision.models as models ct.set_core_number(1) ct.set_core_version("MLU270") torch.set_grad_enabled(False) compound_coef = 0 force_input_size = None # set None to use default size img_path = 'datasets/birdview_vehicles/val/1135.jpg' threshold = 0.2 iou_threshold = 0.2 use_cuda = False use_float16 = False #cudnn.fastest = True #cudnn.benchmark = True obj_list = [ 'large-vehicle', 'small-vehicle' ] # tf bilinear interpolation is different from any other's, just make do input_sizes = [512, 640, 768, 896, 1024, 1280, 1280, 1536] input_size = input_sizes[compound_coef] if force_input_size is None else force_input_size ori_imgs, framed_imgs, framed_metas = preprocess(img_path, max_size=input_size) x = torch.stack([torch.from_numpy(fi) for fi in framed_imgs], 0) print(x) x = x.permute(3, 1, 2, 0) x = x.to(ct.mlu_device()) #print(x) x = x[:, 1:, 2:-1:3, 5:10] #x = x[1,0:100,2] print("打印x:") print(x.cpu())
比如这个例子,我在vscode+mlu270上跑x = x[:, 1:, 2:-1:3, 5:10],程序会出现cnml错误,但是能运行成功
我如果跑x = x[1,0:100,2],就不报slice的错误,是不是在mlu上调用算子的方法和在cuda上用算子的方法不一致
您好,请问您目前是用 逐层模式 还是 融合模式 运行程序呢?同时,辛苦您提供测试代码以及测试环境。展开
请登录后评论