def __call__(self, X):
# generate random values
R = np.random.randn(X.data.shape[0], self.rand_sz)
R = Variable(R.astype("float32"))
# attach random to the inputs
h = F.concat([R, X])
#h = R
h = self.ipt(h)
#h = F.dropout(h)
y = self.out(h)
# prior knowledge: environment observation is one - hot vector
obs = F.softmax(y[:, :-2])
# prior knowledge: reward is in [0,1]
rew = F.sigmoid(y[:,[-2]])
fin = F.sigmoid(y[:, [-1]])
y = F.concat([obs, rew, fin])
return y
评论列表
文章目录