예제 #1
0
 def call(self, inputs):
     return sparsemax(inputs, axis=self.axis)
예제 #2
0
def sparsemax_loss_from_logits(y_true: TensorLike,
                               logits_pred: TensorLike) -> tf.Tensor:
    y_pred = sparsemax(logits_pred)
    loss = sparsemax_loss(logits_pred, y_pred, y_true)
    return loss
예제 #3
0
def sparsemax_loss_from_logits(y_true, logits_pred):
    y_pred = sparsemax(logits_pred)
    loss = sparsemax_loss(logits_pred, y_pred, y_true)
    return loss