Exemplo n.º 1
0
    def TestOut(self, batchtest=False):
        if not batchtest:
            print('Network Out Test Real-time')
            Batch = 1
        else:
            print('Network Out Test Batch')
            Batch = 3

        PhyTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubPhyPara)] for _ in range(Batch)],
                         dtype=torch.float)
        TOOL.ALLP(PhyTemp)
        CompTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubComPara)] for _ in range(Batch)],
                          dtype=torch.float)
        TOOL.ALLP(CompTemp)

        mu_v = self.GetPredictActorOut(x_py=PhyTemp, x_comp=CompTemp) # [3, 1]
        TOOL.ALLP(mu_v)

        mu = mu_v.data.numpy()
        logstd = self.logstd.detach().numpy()
        TOOL.ALLP(mu, 'mu')
        TOOL.ALLP(logstd, "logstd")

        action = mu + np.exp(logstd) * np.random.normal(size=logstd.shape)
        TOOL.ALLP(action, "act")
        action = mu + np.exp(logstd) * np.random.normal(size=logstd.shape)
        TOOL.ALLP(action, "act")
        action = np.clip(action, -1, 1)
        TOOL.ALLP(action, "action clip")
Exemplo n.º 2
0
    def TestOut(self, batchtest=False):
        if not batchtest:
            print('Network Out Test Real-time')
            Batch = 1
        else:
            print('Network Out Test Batch')
            Batch = 3

        PhyTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubPhyPara)] for _ in range(Batch)],
                         dtype=torch.float)
        TOOL.ALLP(PhyTemp)
        CompTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubComPara)] for _ in range(Batch)],
                          dtype=torch.float)
        TOOL.ALLP(CompTemp)

        self.GetPredictActorOut(x_py=PhyTemp, x_comp=CompTemp)
Exemplo n.º 3
0
    def TestOut(self, batchtest=False):
        if not batchtest:
            print('Network Out Test Real-time')
            Batch = 1
        else:
            print('Network Out Test Batch')
            Batch = 3

        PhyTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubPhyPara)] for _ in range(Batch)],
                         dtype=torch.float)
        TOOL.ALLP(PhyTemp)
        CompTemp = tensor([[list(random(size=self.NubTimeSeq)) for _ in range(self.NubComPara)] for _ in range(Batch)],
                          dtype=torch.float)
        TOOL.ALLP(CompTemp)

        val = self.GetPredictCrticOut(x_py=PhyTemp, x_comp=CompTemp) # [3, 1]
        TOOL.ALLP(val, "val")
        val = np.clip(val.data.numpy(), -1, 1)
        TOOL.ALLP(val, "val")