def calculate_loss(self): x = self.get_input_sequences() conv_inputs = self.encode(x, features=self.encode_features) decode_x = tf.concat([x, 1.0 - tf.expand_dims(self.x_is_zero, 2)], axis=2) self.initialize_decode_params(decode_x, features=self.decode_features) y_hat = self.decode(decode_x, conv_inputs, features=self.decode_features) y_hat, p = tf.unstack(y_hat, axis=2, num=2) y_hat = tf.nn.sigmoid(p) * (y_hat + self.x_mean) self.loss = sequence_rmse(self.y, y_hat, self.y_len, weights=self.weights) self.prediction_tensors = { 'preds': tf.nn.relu(y_hat), 'lengths': self.x_len, 'ids': self.y_id, } return self.loss
def calculate_loss(self): x = self.get_input_sequences() preds = self.calculate_outputs(x) loss = sequence_rmse(self.next_reorder_size, preds, self.history_length, 100) return loss