Beispiel #1
0
 def forward(self, *input: Tensor) -> Tensor:
     assert assert_list(lambda x: simplex(x),
                        input), f"input tensor should be a list of simplex."
     assert assert_list(
         lambda x: x.shape == input[0].shape,
         input), "input tensor should have the same dimension"
     mean_prob = sum(input) / input.__len__()
     f_term = self._entropy_criterion(mean_prob)
     mean_entropy: Tensor = sum(
         list(map(lambda x: self._entropy_criterion(x),
                  input))) / len(input)
     assert f_term.shape == mean_entropy.shape
     return f_term - mean_entropy
 def append(self, *obs: Tensor):
     assert obs.__len__() == self.tuple_size
     self.data.append(obs)