편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2020.03.17

    파이썬 부모 클래스 삭제


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

    전체코드는 아래 링크 참고 부탁드립니다. 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
            """
    
    
  • 프로필 알 수 없는 사용자님의 편집
    날짜2020.03.17

    파이썬 부모 클래스 삭제


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

    전체코드는 아래 링크 참고 부탁드립니다. 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
            """