def __call__(self, x_image, t_image, x_action, t_action):
self.y_image, self.y_action = self.predictor(x_image, x_action)
predicted_action = self.action_meaning(
F.argmax(self.y_action, axis=1).data[0])
real_action = self.action_meaning(t_action)
if predicted_action != real_action:
print("Predicted action:", predicted_action,
"it was actually", real_action)
image_loss = F.mean_squared_error(self.y_image, t_image)
self.error_mask = normalize_2d(F.squared_error(self.y_image, t_image))
action_loss = F.softmax_cross_entropy(
self.y_action,
F.expand_dims(np.array(t_action, dtype=np.int32), axis=0),
)
print('Image loss', image_loss.data, ', Action loss:', action_loss.data)
return self.weight * image_loss + (1.0 - self.weight) * action_loss
predictive_autoencoder.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录