PyTorch NotImplementedError in forward

后端 未结 2 1943
说谎
说谎 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:34

    please look carefully at the indentation of your __init__ function: your forward is part of __init__ not part of your module.

提交回复
热议问题