PyTorch NotImplementedError in forward

后端 未结 2 1941
说谎
说谎 2021-01-17 20:12
import torch
import torch.nn as nn

device = torch.device(\'cuda\' if torch.cuda.is_available() else 
\'cpu\')

class Model(nn.Module):
    def __init__(self):
              


        
2条回答
  •  遇见更好的自我
    2021-01-17 20:38

    This error happens when you don't implement the required method from super class, in my case, i had typo on the function name forward. I recommend you check your code indentation.

提交回复
热议问题