파이썬 부모 클래스 삭제

조회수 430회

안녕하세요! 아래 코드는 종속 클래스입니다. 부모 클래스를 삭제하고 아래 코드를 단독으로 사용하려면 어떻게 수정해야 될까요? 감사합니다.

전체코드는 아래 링크 참고 부탁드립니다. https://github.com/Hsankesara/Prototypical-Networks/blob/master/prototypical-net.ipynb

저는 부모클래스인 class Net(nn.Module): 부분을 삭제하고 싶습니다.

class PrototypicalNet(nn.Module):
    def __init__(self, use_gpu=False):
        super(PrototypicalNet, self).__init__()
        self.gpu = use_gpu
        if self.gpu:
            self.f = self.f.cuda()

    def forward(self, datax, datay, Ns,Nc, Nq, total_classes):
        """
        Implementation of one episode in Prototypical Net
        datax: Training images
        datay: Corresponding labels of datax
        Nc: Number  of classes per episode
        Ns: Number of support data per class
        Nq:  Number of query data per class
        total_classes: Total classes in training set
        """

  • Net 구조를 PrototypicalNet 안에서 선언해서 PrototypicalNet 단독으로만 사용하고 싶다는 말씀이신가요? HIAOAIH 2020.3.17 17:27

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)