예제 #1
0
    def state_dict(self):
        state_dict = Map()

        if isinstance(self.model.G, DataParallel) or isinstance(self.model.G, DistributedDataParallel):
            state_dict.G = self.model.G.module.state_dict()
            if self.model.D is not None:
                state_dict.D = self.model.D.module.state_dict()
        else:
            state_dict.G = self.model.G.state_dict()
            if self.model.D is not None:
                state_dict.D = self.model.D.state_dict()

        return state_dict.toDict()
예제 #2
0
    def state_dict(self):
        state_dict = Map()
        state_dict.G = self.G.state_dict()
        if self.D is not None:
            state_dict.D = self.D.state_dict()

        return state_dict.toDict()