成功解决AttributeError: module 'torch.utils' has no attribute 'data'
【摘要】 成功解决AttributeError: module 'torch.utils' has no attribute 'data'
目录
解决问题
解决思路
解决方法
解决问题
AttributeError: module 'torch....
成功解决AttributeError: module 'torch.utils' has no attribute 'data'
目录
解决问题
AttributeError: module 'torch.utils' has no attribute 'data'
解决思路
属性错误:模块的'torch.utils'没有属性'data'
解决方法
只需在顶行添加此代码即可!
import torch.utils.data # 新添加代码
将
-
import logging
-
import numpy as np
-
import torch
-
-
from . import ava_helper as ava_helper
-
from . import cv2_transform as cv2_transform
-
from . import transform as transform
-
from . import utils as utils
-
-
from .build import DATASET_REGISTRY
-
-
logger = logging.getLogger(__name__)
-
-
-
@DATASET_REGISTRY.register()
-
class Ava(torch.utils.data.Dataset):
-
"""
-
AVA Dataset
-
"""
-
-
def __init__(self, cfg, split):
-
self.cfg = cfg
-
self._split = split
更改为
-
import logging
-
import numpy as np
-
import torch
-
import torch.utils.data # 新添加代码
-
-
from . import ava_helper as ava_helper
-
from . import cv2_transform as cv2_transform
-
from . import transform as transform
-
from . import utils as utils
-
-
from .build import DATASET_REGISTRY
-
-
logger = logging.getLogger(__name__)
-
-
-
@DATASET_REGISTRY.register()
-
class Ava(torch.utils.data.Dataset):
-
"""
-
AVA Dataset
-
"""
-
-
def __init__(self, cfg, split):
-
self.cfg = cfg
-
self._split = split
文章来源: yunyaniu.blog.csdn.net,作者:一个处女座的程序猿,版权归原作者所有,如需转载,请联系作者。
原文链接:yunyaniu.blog.csdn.net/article/details/103882523
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)