def __call__(self, x):
     h = x
     for layer in self.hidden_layers:
         h = F.relu(layer(h))
     #for
     p = F.softmax(self.output_layer(h))
     return D.Categorical(p)
Пример #2
0
 def make_categorical_dist(self, is_gpu=False):
     p = numpy.random.normal(size=self.shape + (3, )).astype(numpy.float32)
     p = numpy.exp(p)
     p /= numpy.expand_dims(p.sum(axis=-1), axis=-1)
     params = self.encode_params({"p": p}, is_gpu)
     return distributions.Categorical(**params)