SoftmaxCrossEntropyLoss#

  • Domain: ai.onnx

  • Since version: 13

Loss function that measures the softmax cross entropy between ‘scores’ and ‘labels’. This operator first computes a loss tensor whose shape is identical to the labels input. If the input is 2-D with shape (N, C), the loss tensor may be a N-element vector L = (l_1, l_2, …, l_N). If the input is N-D tensor with shape (N, C, D1, D2, …, Dk), the loss tensor L may have (N, D1, D2, …, Dk) as its shape and L[i,][j_1][j_2]…[j_k] denotes a scalar element in L. After L is available, this operator can optionally do a reduction operator.

  • shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,…, Dk), with K >= 1 in case of K-dimensional loss.

  • shape(labels): (N) where each value is 0 = 1 in case of K-dimensional loss.

The loss for one sample, l_i, can calculated as follows:

l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes.

or

l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided.

loss is zero for the case when label-value equals ignore_index.

l[i][d1][d2]...[dk]  = 0, when labels[n][d1][d2]...[dk] = ignore_index

where:

p = Softmax(scores)
y = Log(p)
c = labels[i][d1][d2]...[dk]

Finally, L is optionally reduced:

  • If reduction = ‘none’, the output is L with shape (N, D1, D2, …, Dk).

  • If reduction = ‘sum’, the output is scalar: Sum(L).

  • If reduction = ‘mean’, the output is scalar: ReduceMean(L), or if weight is provided: ReduceSum(L) / ReduceSum(W), where tensor W is of shape (N, D1, D2, ..., Dk) and W[n][d1][d2]...[dk] = weights[labels[i][d1][d2]...[dk]].

Inputs

  • scores (T): The predicted outputs with shape [batch_size, class_size], or [batch_size, class_size, D1, D2 , …, Dk], where K is the number of dimensions.

  • labels (Tind): The ground truth output tensor, with shape [batch_size], or [batch_size, D1, D2, …, Dk], where K is the number of dimensions. Labels element value shall be in range of [0, C). If ignore_index is specified, it may have a value outside [0, C) and the label values should either be in the range [0, C) or have the value ignore_index.

  • weights (T): A manual rescaling weight given to each class. If given, it has to be a 1D Tensor assigning weight to each of the classes. Otherwise, it is treated as if having all ones.

Outputs

Between 1 and 2 outputs.

  • output (T): Weighted loss float Tensor. If reduction is ‘none’, this has the shape of [batch_size], or [batch_size, D1, D2, …, Dk] in case of K-dimensional loss. Otherwise, it is a scalar.

  • log_prob (T): Log probability tensor. If the output of softmax is prob, its value is log(prob).

Attributes

  • ignore_index (int): Specifies a target value that is ignored and does not contribute to the input gradient. It’s an optional value.

  • reduction (string): Type of reduction to apply to loss: none, sum, mean(default). ‘none’: no reduction will be applied, ‘sum’: the output will be summed. ‘mean’: the sum of the output will be divided by the number of elements in the output.

Type Constraints

  • T: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).

  • Tind: Constrain target to integer types Allowed types: tensor(int32), tensor(int64).

Examples#

test_cc_reference_sce_nonfinite

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 2), dtype=float32
    [[ inf,   0.],
     [-inf, -inf],
     [ nan,   0.]]
  labels: shape=(3,), dtype=int64
    [0, 1, 1]

Outputs:
  loss: shape=(3,), dtype=float32
    [nan, nan, nan]
  log_prob: shape=(3, 2), dtype=float32
    [[nan, nan],
     [nan, nan],
     [nan, nan]]

test_cc_reference_sce_single_class

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 1), dtype=float32
    [[ 10.],
     [-20.]]
  labels: shape=(2,), dtype=int64
    [0, 0]

Outputs:
  loss: shape=(2,), dtype=float32
    [0., 0.]
  log_prob: shape=(2, 1), dtype=float32
    [[0.],
     [0.]]

test_cc_reference_sce_small_loss_bfloat16_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(), dtype=bfloat16
    3.05008e-08

test_cc_reference_sce_small_loss_bfloat16_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(), dtype=bfloat16
    3.05008e-08
  log_prob: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]]]]

test_cc_reference_sce_small_loss_bfloat16_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(3, 1, 2), dtype=bfloat16
    [[[3.05008e-08, 3.05008e-08]],

     [[6.10016e-08, 6.10016e-08]],

     [[0, 0]]]

test_cc_reference_sce_small_loss_bfloat16_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(3, 1, 2), dtype=bfloat16
    [[[3.05008e-08, 3.05008e-08]],

     [[6.10016e-08, 6.10016e-08]],

     [[0, 0]]]
  log_prob: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]]]]

test_cc_reference_sce_small_loss_bfloat16_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(), dtype=bfloat16
    1.82539e-07

test_cc_reference_sce_small_loss_bfloat16_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[0, 0]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[0, 0]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[0, 0]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=bfloat16
    [1, 2, 3]

Outputs:
  loss: shape=(), dtype=bfloat16
    1.82539e-07
  log_prob: shape=(3, 3, 1, 2), dtype=bfloat16
    [[[[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]],

      [[-18, -18]]],


     [[[-18, -18]],

      [[-18, -18]],

      [[-3.05008e-08, -3.05008e-08]]]]

test_cc_reference_sce_small_loss_float16_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float16
    9.08e-05

test_cc_reference_sce_small_loss_float16_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float16
    9.08e-05
  log_prob: shape=(3, 3, 1, 2), dtype=float16
    [[[[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]]]]

test_cc_reference_sce_small_loss_float16_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(3, 1, 2), dtype=float16
    [[[9.078e-05, 9.078e-05]],

     [[1.816e-04, 1.816e-04]],

     [[0.000e+00, 0.000e+00]]]

test_cc_reference_sce_small_loss_float16_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(3, 1, 2), dtype=float16
    [[[9.078e-05, 9.078e-05]],

     [[1.816e-04, 1.816e-04]],

     [[0.000e+00, 0.000e+00]]]
  log_prob: shape=(3, 3, 1, 2), dtype=float16
    [[[[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]]]]

test_cc_reference_sce_small_loss_float16_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float16
    0.0005445

test_cc_reference_sce_small_loss_float16_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float16
    [[[[  0.,   0.]],

      [[-10., -10.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[  0.,   0.]],

      [[-10., -10.]]],


     [[[-10., -10.]],

      [[-10., -10.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float16
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float16
    0.0005445
  log_prob: shape=(3, 3, 1, 2), dtype=float16
    [[[[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]],

      [[-1.00e+01, -1.00e+01]]],


     [[[-1.00e+01, -1.00e+01]],

      [[-1.00e+01, -1.00e+01]],

      [[-9.08e-05, -9.08e-05]]]]

test_cc_reference_sce_small_loss_float32_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float32
    3.0459958e-08

test_cc_reference_sce_small_loss_float32_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float32
    3.0459958e-08
  log_prob: shape=(3, 3, 1, 2), dtype=float32
    [[[[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]]]]

test_cc_reference_sce_small_loss_float32_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(3, 1, 2), dtype=float32
    [[[3.0459958e-08, 3.0459958e-08]],

     [[6.0919916e-08, 6.0919916e-08]],

     [[0.0000000e+00, 0.0000000e+00]]]

test_cc_reference_sce_small_loss_float32_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(3, 1, 2), dtype=float32
    [[[3.0459958e-08, 3.0459958e-08]],

     [[6.0919916e-08, 6.0919916e-08]],

     [[0.0000000e+00, 0.0000000e+00]]]
  log_prob: shape=(3, 3, 1, 2), dtype=float32
    [[[[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]]]]

test_cc_reference_sce_small_loss_float32_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float32
    1.8275975e-07

test_cc_reference_sce_small_loss_float32_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
    ignore_index = -1
Inputs:
  scores: shape=(3, 3, 1, 2), dtype=float32
    [[[[  0.,   0.]],

      [[-18., -18.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[  0.,   0.]],

      [[-18., -18.]]],


     [[[-18., -18.]],

      [[-18., -18.]],

      [[  0.,   0.]]]]
  labels: shape=(3, 1, 2), dtype=int64
    [[[ 0,  0]],

     [[ 1,  1]],

     [[-1, -1]]]
  weights: shape=(3,), dtype=float32
    [1., 2., 3.]

Outputs:
  loss: shape=(), dtype=float32
    1.8275975e-07
  log_prob: shape=(3, 3, 1, 2), dtype=float32
    [[[[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]],

      [[-1.8000000e+01, -1.8000000e+01]]],


     [[[-1.8000000e+01, -1.8000000e+01]],

      [[-1.8000000e+01, -1.8000000e+01]],

      [[-3.0459958e-08, -3.0459958e-08]]]]

test_cc_reference_sce_tied_maxima

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 3), dtype=float32
    [[   0.,    0., -200.],
     [   4.,    4.,    4.]]
  labels: shape=(2,), dtype=int64
    [1, 2]

Outputs:
  loss: shape=(2,), dtype=float32
    [0.6931472, 1.0986123]
  log_prob: shape=(2, 3), dtype=float32
    [[  -0.6931472,   -0.6931472, -200.69315  ],
     [  -1.0986123,   -1.0986123,   -1.0986123]]

test_cc_sce_NCd1_mean_weight_negative_ii

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-4.0000001e-01, -3.0000001e-01],
      [-2.0000002e-01, -1.0000002e-01],
      [-1.4901161e-08,  9.9999987e-02],
      [ 1.9999999e-01,  2.9999998e-01],
      [ 3.9999998e-01,  4.9999997e-01]],

     [[ 5.9999996e-01,  6.9999999e-01],
      [ 8.0000001e-01,  9.0000004e-01],
      [ 1.0000000e+00,  1.1000000e+00],
      [ 1.2000000e+00,  1.3000001e+00],
      [ 1.4000001e+00, -4.0000001e-01]],

     [[-3.0000001e-01, -2.0000002e-01],
      [-1.0000002e-01, -1.4901161e-08],
      [ 9.9999987e-02,  1.9999999e-01],
      [ 2.9999998e-01,  3.9999998e-01],
      [ 4.9999997e-01,  5.9999996e-01]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.6343838

test_cc_sce_NCd1_mean_weight_negative_ii_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = -1
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-4.0000001e-01, -3.0000001e-01],
      [-2.0000002e-01, -1.0000002e-01],
      [-1.4901161e-08,  9.9999987e-02],
      [ 1.9999999e-01,  2.9999998e-01],
      [ 3.9999998e-01,  4.9999997e-01]],

     [[ 5.9999996e-01,  6.9999999e-01],
      [ 8.0000001e-01,  9.0000004e-01],
      [ 1.0000000e+00,  1.1000000e+00],
      [ 1.2000000e+00,  1.3000001e+00],
      [ 1.4000001e+00, -4.0000001e-01]],

     [[-3.0000001e-01, -2.0000002e-01],
      [-1.0000002e-01, -1.4901161e-08],
      [ 9.9999987e-02,  1.9999999e-01],
      [ 2.9999998e-01,  3.9999998e-01],
      [ 4.9999997e-01,  5.9999996e-01]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.6343838
  log_prob: shape=(3, 5, 2), dtype=float32
    [[[-2.0490966, -2.0490966],
      [-1.8490967, -1.8490965],
      [-1.6490966, -1.6490966],
      [-1.4490967, -1.4490967],
      [-1.2490966, -1.2490966]],

     [[-2.0490968, -1.769551 ],
      [-1.8490968, -1.569551 ],
      [-1.6490967, -1.369551 ],
      [-1.4490967, -1.1695509],
      [-1.2490966, -2.869551 ]],

     [[-2.0490966, -2.0490966],
      [-1.8490965, -1.8490965],
      [-1.6490966, -1.6490966],
      [-1.4490967, -1.4490967],
      [-1.2490966, -1.2490966]]]

test_cc_sce_NCd1d2d3_none_no_weight_negative_ii

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "none"
    ignore_index = -5
Inputs:
  scores: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-0.5  , -0.375],
        [-0.25 , -0.125]],

       [[ 0.   ,  0.125],
        [ 0.25 ,  0.375]]],


      [[[ 0.5  ,  0.625],
        [ 0.75 ,  0.875]],

       [[ 1.   ,  1.125],
        [ 1.25 ,  1.375]]],


      [[[ 1.5  , -0.5  ],
        [-0.375, -0.25 ]],

       [[-0.125,  0.   ],
        [ 0.125,  0.25 ]]],


      [[[ 0.375,  0.5  ],
        [ 0.625,  0.75 ]],

       [[ 0.875,  1.   ],
        [ 1.125,  1.25 ]]]],



     [[[[ 1.375,  1.5  ],
        [-0.5  , -0.375]],

       [[-0.25 , -0.125],
        [ 0.   ,  0.125]]],


      [[[ 0.25 ,  0.375],
        [ 0.5  ,  0.625]],

       [[ 0.75 ,  0.875],
        [ 1.   ,  1.125]]],


      [[[ 1.25 ,  1.375],
        [ 1.5  , -0.5  ]],

       [[-0.375, -0.25 ],
        [-0.125,  0.   ]]],


      [[[ 0.125,  0.25 ],
        [ 0.375,  0.5  ]],

       [[ 0.625,  0.75 ],
        [ 0.875,  1.   ]]]]]
  labels: shape=(2, 2, 2, 2), dtype=int64
    [[[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]],


     [[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]]]

Outputs:
  loss: shape=(2, 2, 2, 2), dtype=float32
    [[[[2.60315   , 0.94586074],
       [2.0708609 , 1.0708607 ]],

      [[1.9458607 , 0.94586074],
       [2.0708609 , 1.0708607 ]]],


     [[[0.9137492 , 2.0387492 ],
       [0.6031498 , 1.0708607 ]],

      [[1.9458607 , 0.94586074],
       [2.0708609 , 1.0708607 ]]]]

test_cc_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
    ignore_index = -5
Inputs:
  scores: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-0.5  , -0.375],
        [-0.25 , -0.125]],

       [[ 0.   ,  0.125],
        [ 0.25 ,  0.375]]],


      [[[ 0.5  ,  0.625],
        [ 0.75 ,  0.875]],

       [[ 1.   ,  1.125],
        [ 1.25 ,  1.375]]],


      [[[ 1.5  , -0.5  ],
        [-0.375, -0.25 ]],

       [[-0.125,  0.   ],
        [ 0.125,  0.25 ]]],


      [[[ 0.375,  0.5  ],
        [ 0.625,  0.75 ]],

       [[ 0.875,  1.   ],
        [ 1.125,  1.25 ]]]],



     [[[[ 1.375,  1.5  ],
        [-0.5  , -0.375]],

       [[-0.25 , -0.125],
        [ 0.   ,  0.125]]],


      [[[ 0.25 ,  0.375],
        [ 0.5  ,  0.625]],

       [[ 0.75 ,  0.875],
        [ 1.   ,  1.125]]],


      [[[ 1.25 ,  1.375],
        [ 1.5  , -0.5  ]],

       [[-0.375, -0.25 ],
        [-0.125,  0.   ]]],


      [[[ 0.125,  0.25 ],
        [ 0.375,  0.5  ]],

       [[ 0.625,  0.75 ],
        [ 0.875,  1.   ]]]]]
  labels: shape=(2, 2, 2, 2), dtype=int64
    [[[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]],


     [[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]]]

Outputs:
  loss: shape=(2, 2, 2, 2), dtype=float32
    [[[[2.60315   , 0.94586074],
       [2.0708609 , 1.0708607 ]],

      [[1.9458607 , 0.94586074],
       [2.0708609 , 1.0708607 ]]],


     [[[0.9137492 , 2.0387492 ],
       [0.6031498 , 1.0708607 ]],

      [[1.9458607 , 0.94586074],
       [2.0708609 , 1.0708607 ]]]]
  log_prob: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-2.60315   , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]],

       [[-1.9458607 , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]]],


      [[[-1.6031498 , -0.94586074],
        [-0.94586074, -0.94586074]],

       [[-0.94586074, -0.94586074],
        [-0.94586074, -0.94586074]]],


      [[[-0.6031498 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]],

       [[-2.0708609 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]]],


      [[[-1.7281498 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]],

       [[-1.0708607 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]]]],



     [[[[-0.9137492 , -0.9137492 ],
        [-2.60315   , -1.9458607 ]],

       [[-1.9458607 , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]]],


      [[[-2.0387492 , -2.0387492 ],
        [-1.6031498 , -0.94586074]],

       [[-0.94586074, -0.94586074],
        [-0.94586074, -0.94586074]]],


      [[[-1.0387492 , -1.0387492 ],
        [-0.6031498 , -2.0708609 ]],

       [[-2.0708609 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]]],


      [[[-2.1637492 , -2.1637492 ],
        [-1.7281498 , -1.0708607 ]],

       [[-1.0708607 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]]]]]

test_cc_sce_NCd1d2d3_sum_weight_high_ii

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
    ignore_index = 4
Inputs:
  scores: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-0.5  , -0.375],
        [-0.25 , -0.125]],

       [[ 0.   ,  0.125],
        [ 0.25 ,  0.375]]],


      [[[ 0.5  ,  0.625],
        [ 0.75 ,  0.875]],

       [[ 1.   ,  1.125],
        [ 1.25 ,  1.375]]],


      [[[ 1.5  , -0.5  ],
        [-0.375, -0.25 ]],

       [[-0.125,  0.   ],
        [ 0.125,  0.25 ]]],


      [[[ 0.375,  0.5  ],
        [ 0.625,  0.75 ]],

       [[ 0.875,  1.   ],
        [ 1.125,  1.25 ]]]],



     [[[[ 1.375,  1.5  ],
        [-0.5  , -0.375]],

       [[-0.25 , -0.125],
        [ 0.   ,  0.125]]],


      [[[ 0.25 ,  0.375],
        [ 0.5  ,  0.625]],

       [[ 0.75 ,  0.875],
        [ 1.   ,  1.125]]],


      [[[ 1.25 ,  1.375],
        [ 1.5  , -0.5  ]],

       [[-0.375, -0.25 ],
        [-0.125,  0.   ]]],


      [[[ 0.125,  0.25 ],
        [ 0.375,  0.5  ]],

       [[ 0.625,  0.75 ],
        [ 0.875,  1.   ]]]]]
  labels: shape=(2, 2, 2, 2), dtype=int64
    [[[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]],


     [[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]]]
  weights: shape=(4,), dtype=float32
    [0.2, 0.3, 0.6, 0.1]

Outputs:
  loss: shape=(), dtype=float32
    7.4624076

test_cc_sce_NCd1d2d3_sum_weight_high_ii_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
    ignore_index = 4
Inputs:
  scores: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-0.5  , -0.375],
        [-0.25 , -0.125]],

       [[ 0.   ,  0.125],
        [ 0.25 ,  0.375]]],


      [[[ 0.5  ,  0.625],
        [ 0.75 ,  0.875]],

       [[ 1.   ,  1.125],
        [ 1.25 ,  1.375]]],


      [[[ 1.5  , -0.5  ],
        [-0.375, -0.25 ]],

       [[-0.125,  0.   ],
        [ 0.125,  0.25 ]]],


      [[[ 0.375,  0.5  ],
        [ 0.625,  0.75 ]],

       [[ 0.875,  1.   ],
        [ 1.125,  1.25 ]]]],



     [[[[ 1.375,  1.5  ],
        [-0.5  , -0.375]],

       [[-0.25 , -0.125],
        [ 0.   ,  0.125]]],


      [[[ 0.25 ,  0.375],
        [ 0.5  ,  0.625]],

       [[ 0.75 ,  0.875],
        [ 1.   ,  1.125]]],


      [[[ 1.25 ,  1.375],
        [ 1.5  , -0.5  ]],

       [[-0.375, -0.25 ],
        [-0.125,  0.   ]]],


      [[[ 0.125,  0.25 ],
        [ 0.375,  0.5  ]],

       [[ 0.625,  0.75 ],
        [ 0.875,  1.   ]]]]]
  labels: shape=(2, 2, 2, 2), dtype=int64
    [[[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]],


     [[[0, 1],
       [2, 3]],

      [[0, 1],
       [2, 3]]]]
  weights: shape=(4,), dtype=float32
    [0.2, 0.3, 0.6, 0.1]

Outputs:
  loss: shape=(), dtype=float32
    7.4624076
  log_prob: shape=(2, 4, 2, 2, 2), dtype=float32
    [[[[[-2.60315   , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]],

       [[-1.9458607 , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]]],


      [[[-1.6031498 , -0.94586074],
        [-0.94586074, -0.94586074]],

       [[-0.94586074, -0.94586074],
        [-0.94586074, -0.94586074]]],


      [[[-0.6031498 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]],

       [[-2.0708609 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]]],


      [[[-1.7281498 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]],

       [[-1.0708607 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]]]],



     [[[[-0.9137492 , -0.9137492 ],
        [-2.60315   , -1.9458607 ]],

       [[-1.9458607 , -1.9458607 ],
        [-1.9458607 , -1.9458607 ]]],


      [[[-2.0387492 , -2.0387492 ],
        [-1.6031498 , -0.94586074]],

       [[-0.94586074, -0.94586074],
        [-0.94586074, -0.94586074]]],


      [[[-1.0387492 , -1.0387492 ],
        [-0.6031498 , -2.0708609 ]],

       [[-2.0708609 , -2.0708609 ],
        [-2.0708609 , -2.0708609 ]]],


      [[[-2.1637492 , -2.1637492 ],
        [-1.7281498 , -1.0708607 ]],

       [[-1.0708607 , -1.0708607 ],
        [-1.0708607 , -1.0708607 ]]]]]

test_cc_sce_NCd1d2d3d4d5_mean_weight

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-0.5   , -0.4375],
          [-0.375 , -0.3125]],

         [[-0.25  , -0.1875],
          [-0.125 , -0.0625]]],


        [[[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]],

         [[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]]]],



       [[[[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]],

         [[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]]],


        [[[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]],

         [[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]]]]],




      [[[[[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]],

         [[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]]],


        [[[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]],

         [[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]]]],



       [[[[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]],

         [[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]]],


        [[[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]],

         [[ 1.1875,  1.25  ],
          [ 1.3125,  1.375 ]]]]],




      [[[[[ 1.4375,  1.5   ],
          [-0.5   , -0.4375]],

         [[-0.375 , -0.3125],
          [-0.25  , -0.1875]]],


        [[[-0.125 , -0.0625],
          [ 0.    ,  0.0625]],

         [[ 0.125 ,  0.1875],
          [ 0.25  ,  0.3125]]]],



       [[[[ 0.375 ,  0.4375],
          [ 0.5   ,  0.5625]],

         [[ 0.625 ,  0.6875],
          [ 0.75  ,  0.8125]]],


        [[[ 0.875 ,  0.9375],
          [ 1.    ,  1.0625]],

         [[ 1.125 ,  1.1875],
          [ 1.25  ,  1.3125]]]]]],





     [[[[[[ 1.375 ,  1.4375],
          [ 1.5   , -0.5   ]],

         [[-0.4375, -0.375 ],
          [-0.3125, -0.25  ]]],


        [[[-0.1875, -0.125 ],
          [-0.0625,  0.    ]],

         [[ 0.0625,  0.125 ],
          [ 0.1875,  0.25  ]]]],



       [[[[ 0.3125,  0.375 ],
          [ 0.4375,  0.5   ]],

         [[ 0.5625,  0.625 ],
          [ 0.6875,  0.75  ]]],


        [[[ 0.8125,  0.875 ],
          [ 0.9375,  1.    ]],

         [[ 1.0625,  1.125 ],
          [ 1.1875,  1.25  ]]]]],




      [[[[[ 1.3125,  1.375 ],
          [ 1.4375,  1.5   ]],

         [[-0.5   , -0.4375],
          [-0.375 , -0.3125]]],


        [[[-0.25  , -0.1875],
          [-0.125 , -0.0625]],

         [[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]]]],



       [[[[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]],

         [[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]]],


        [[[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]],

         [[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]]]]],




      [[[[[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]],

         [[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]]],


        [[[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]],

         [[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]]]],



       [[[[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]],

         [[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]]],


        [[[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]],

         [[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]]]]]]]
  labels: shape=(2, 2, 2, 2, 2, 2), dtype=int64
    [[[[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]],



      [[[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]],


       [[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]]]],




     [[[[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]],


       [[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]]],



      [[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]]]]
  weights: shape=(3,), dtype=float32
    [0.5, 0.3, 0.2]

Outputs:
  loss: shape=(), dtype=float32
    1.1587229

test_cc_sce_NCd1d2d3d4d5_mean_weight_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-0.5   , -0.4375],
          [-0.375 , -0.3125]],

         [[-0.25  , -0.1875],
          [-0.125 , -0.0625]]],


        [[[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]],

         [[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]]]],



       [[[[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]],

         [[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]]],


        [[[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]],

         [[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]]]]],




      [[[[[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]],

         [[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]]],


        [[[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]],

         [[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]]]],



       [[[[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]],

         [[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]]],


        [[[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]],

         [[ 1.1875,  1.25  ],
          [ 1.3125,  1.375 ]]]]],




      [[[[[ 1.4375,  1.5   ],
          [-0.5   , -0.4375]],

         [[-0.375 , -0.3125],
          [-0.25  , -0.1875]]],


        [[[-0.125 , -0.0625],
          [ 0.    ,  0.0625]],

         [[ 0.125 ,  0.1875],
          [ 0.25  ,  0.3125]]]],



       [[[[ 0.375 ,  0.4375],
          [ 0.5   ,  0.5625]],

         [[ 0.625 ,  0.6875],
          [ 0.75  ,  0.8125]]],


        [[[ 0.875 ,  0.9375],
          [ 1.    ,  1.0625]],

         [[ 1.125 ,  1.1875],
          [ 1.25  ,  1.3125]]]]]],





     [[[[[[ 1.375 ,  1.4375],
          [ 1.5   , -0.5   ]],

         [[-0.4375, -0.375 ],
          [-0.3125, -0.25  ]]],


        [[[-0.1875, -0.125 ],
          [-0.0625,  0.    ]],

         [[ 0.0625,  0.125 ],
          [ 0.1875,  0.25  ]]]],



       [[[[ 0.3125,  0.375 ],
          [ 0.4375,  0.5   ]],

         [[ 0.5625,  0.625 ],
          [ 0.6875,  0.75  ]]],


        [[[ 0.8125,  0.875 ],
          [ 0.9375,  1.    ]],

         [[ 1.0625,  1.125 ],
          [ 1.1875,  1.25  ]]]]],




      [[[[[ 1.3125,  1.375 ],
          [ 1.4375,  1.5   ]],

         [[-0.5   , -0.4375],
          [-0.375 , -0.3125]]],


        [[[-0.25  , -0.1875],
          [-0.125 , -0.0625]],

         [[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]]]],



       [[[[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]],

         [[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]]],


        [[[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]],

         [[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]]]]],




      [[[[[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]],

         [[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]]],


        [[[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]],

         [[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]]]],



       [[[[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]],

         [[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]]],


        [[[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]],

         [[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]]]]]]]
  labels: shape=(2, 2, 2, 2, 2, 2), dtype=int64
    [[[[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]],



      [[[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]],


       [[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]]]],




     [[[[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]],


       [[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]]],



      [[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]]]]
  weights: shape=(3,), dtype=float32
    [0.5, 0.3, 0.2]

Outputs:
  loss: shape=(), dtype=float32
    1.1587229
  log_prob: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-2.7298398, -2.1838903],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]],



       [[[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]]],




      [[[[[-0.7298399, -2.2463903],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]],



       [[[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]]],




      [[[[[-0.7923399, -0.2463904],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]],



       [[[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]]]],





     [[[[[[-1.037414 , -1.037414 ],
          [-1.037414 , -2.7298398]],

         [[-2.1838903, -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]],



       [[[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]]],




      [[[[[-1.099914 , -1.099914 ],
          [-1.099914 , -0.7298399]],

         [[-2.2463903, -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]],



       [[[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]]],




      [[[[[-1.162414 , -1.162414 ],
          [-1.162414 , -0.7923399]],

         [[-0.2463904, -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]],



       [[[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]]]]]

test_cc_sce_NCd1d2d3d4d5_none_no_weight

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-0.5   , -0.4375],
          [-0.375 , -0.3125]],

         [[-0.25  , -0.1875],
          [-0.125 , -0.0625]]],


        [[[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]],

         [[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]]]],



       [[[[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]],

         [[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]]],


        [[[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]],

         [[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]]]]],




      [[[[[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]],

         [[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]]],


        [[[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]],

         [[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]]]],



       [[[[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]],

         [[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]]],


        [[[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]],

         [[ 1.1875,  1.25  ],
          [ 1.3125,  1.375 ]]]]],




      [[[[[ 1.4375,  1.5   ],
          [-0.5   , -0.4375]],

         [[-0.375 , -0.3125],
          [-0.25  , -0.1875]]],


        [[[-0.125 , -0.0625],
          [ 0.    ,  0.0625]],

         [[ 0.125 ,  0.1875],
          [ 0.25  ,  0.3125]]]],



       [[[[ 0.375 ,  0.4375],
          [ 0.5   ,  0.5625]],

         [[ 0.625 ,  0.6875],
          [ 0.75  ,  0.8125]]],


        [[[ 0.875 ,  0.9375],
          [ 1.    ,  1.0625]],

         [[ 1.125 ,  1.1875],
          [ 1.25  ,  1.3125]]]]]],





     [[[[[[ 1.375 ,  1.4375],
          [ 1.5   , -0.5   ]],

         [[-0.4375, -0.375 ],
          [-0.3125, -0.25  ]]],


        [[[-0.1875, -0.125 ],
          [-0.0625,  0.    ]],

         [[ 0.0625,  0.125 ],
          [ 0.1875,  0.25  ]]]],



       [[[[ 0.3125,  0.375 ],
          [ 0.4375,  0.5   ]],

         [[ 0.5625,  0.625 ],
          [ 0.6875,  0.75  ]]],


        [[[ 0.8125,  0.875 ],
          [ 0.9375,  1.    ]],

         [[ 1.0625,  1.125 ],
          [ 1.1875,  1.25  ]]]]],




      [[[[[ 1.3125,  1.375 ],
          [ 1.4375,  1.5   ]],

         [[-0.5   , -0.4375],
          [-0.375 , -0.3125]]],


        [[[-0.25  , -0.1875],
          [-0.125 , -0.0625]],

         [[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]]]],



       [[[[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]],

         [[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]]],


        [[[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]],

         [[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]]]]],




      [[[[[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]],

         [[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]]],


        [[[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]],

         [[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]]]],



       [[[[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]],

         [[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]]],


        [[[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]],

         [[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]]]]]]]
  labels: shape=(2, 2, 2, 2, 2, 2), dtype=int64
    [[[[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]],



      [[[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]],


       [[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]]]],




     [[[[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]],


       [[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]]],



      [[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]]]]

Outputs:
  loss: shape=(2, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[2.7298398, 2.2463903],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]],


       [[[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]],

        [[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]]]],



      [[[[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]],

        [[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]]],


       [[[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]]]],




     [[[[[1.162414 , 1.037414 ],
         [1.099914 , 0.7923399]],

        [[2.1838903, 1.099914 ],
         [1.162414 , 1.037414 ]]],


       [[[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]],

        [[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]]]],



      [[[[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]],


       [[[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]],

        [[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]]]]]]

test_cc_sce_NCd1d2d3d4d5_none_no_weight_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-0.5   , -0.4375],
          [-0.375 , -0.3125]],

         [[-0.25  , -0.1875],
          [-0.125 , -0.0625]]],


        [[[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]],

         [[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]]]],



       [[[[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]],

         [[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]]],


        [[[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]],

         [[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]]]]],




      [[[[[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]],

         [[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]]],


        [[[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]],

         [[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]]]],



       [[[[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]],

         [[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]]],


        [[[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]],

         [[ 1.1875,  1.25  ],
          [ 1.3125,  1.375 ]]]]],




      [[[[[ 1.4375,  1.5   ],
          [-0.5   , -0.4375]],

         [[-0.375 , -0.3125],
          [-0.25  , -0.1875]]],


        [[[-0.125 , -0.0625],
          [ 0.    ,  0.0625]],

         [[ 0.125 ,  0.1875],
          [ 0.25  ,  0.3125]]]],



       [[[[ 0.375 ,  0.4375],
          [ 0.5   ,  0.5625]],

         [[ 0.625 ,  0.6875],
          [ 0.75  ,  0.8125]]],


        [[[ 0.875 ,  0.9375],
          [ 1.    ,  1.0625]],

         [[ 1.125 ,  1.1875],
          [ 1.25  ,  1.3125]]]]]],





     [[[[[[ 1.375 ,  1.4375],
          [ 1.5   , -0.5   ]],

         [[-0.4375, -0.375 ],
          [-0.3125, -0.25  ]]],


        [[[-0.1875, -0.125 ],
          [-0.0625,  0.    ]],

         [[ 0.0625,  0.125 ],
          [ 0.1875,  0.25  ]]]],



       [[[[ 0.3125,  0.375 ],
          [ 0.4375,  0.5   ]],

         [[ 0.5625,  0.625 ],
          [ 0.6875,  0.75  ]]],


        [[[ 0.8125,  0.875 ],
          [ 0.9375,  1.    ]],

         [[ 1.0625,  1.125 ],
          [ 1.1875,  1.25  ]]]]],




      [[[[[ 1.3125,  1.375 ],
          [ 1.4375,  1.5   ]],

         [[-0.5   , -0.4375],
          [-0.375 , -0.3125]]],


        [[[-0.25  , -0.1875],
          [-0.125 , -0.0625]],

         [[ 0.    ,  0.0625],
          [ 0.125 ,  0.1875]]]],



       [[[[ 0.25  ,  0.3125],
          [ 0.375 ,  0.4375]],

         [[ 0.5   ,  0.5625],
          [ 0.625 ,  0.6875]]],


        [[[ 0.75  ,  0.8125],
          [ 0.875 ,  0.9375]],

         [[ 1.    ,  1.0625],
          [ 1.125 ,  1.1875]]]]],




      [[[[[ 1.25  ,  1.3125],
          [ 1.375 ,  1.4375]],

         [[ 1.5   , -0.5   ],
          [-0.4375, -0.375 ]]],


        [[[-0.3125, -0.25  ],
          [-0.1875, -0.125 ]],

         [[-0.0625,  0.    ],
          [ 0.0625,  0.125 ]]]],



       [[[[ 0.1875,  0.25  ],
          [ 0.3125,  0.375 ]],

         [[ 0.4375,  0.5   ],
          [ 0.5625,  0.625 ]]],


        [[[ 0.6875,  0.75  ],
          [ 0.8125,  0.875 ]],

         [[ 0.9375,  1.    ],
          [ 1.0625,  1.125 ]]]]]]]
  labels: shape=(2, 2, 2, 2, 2, 2), dtype=int64
    [[[[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]],



      [[[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]],


       [[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]]]],




     [[[[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]],


       [[[1, 2],
         [0, 1]],

        [[2, 0],
         [1, 2]]]],



      [[[[0, 1],
         [2, 0]],

        [[1, 2],
         [0, 1]]],


       [[[2, 0],
         [1, 2]],

        [[0, 1],
         [2, 0]]]]]]

Outputs:
  loss: shape=(2, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[2.7298398, 2.2463903],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]],


       [[[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]],

        [[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]]]],



      [[[[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]],

        [[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]]],


       [[[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]]]],




     [[[[[1.162414 , 1.037414 ],
         [1.099914 , 0.7923399]],

        [[2.1838903, 1.099914 ],
         [1.162414 , 1.037414 ]]],


       [[[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]],

        [[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]]]],



      [[[[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]],

        [[1.099914 , 1.162414 ],
         [1.037414 , 1.099914 ]]],


       [[[1.162414 , 1.037414 ],
         [1.099914 , 1.162414 ]],

        [[1.037414 , 1.099914 ],
         [1.162414 , 1.037414 ]]]]]]
  log_prob: shape=(2, 3, 2, 2, 2, 2, 2), dtype=float32
    [[[[[[[-2.7298398, -2.1838903],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]],



       [[[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]]],




      [[[[[-0.7298399, -2.2463903],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]],



       [[[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]]],




      [[[[[-0.7923399, -0.2463904],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]],



       [[[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]]]],





     [[[[[[-1.037414 , -1.037414 ],
          [-1.037414 , -2.7298398]],

         [[-2.1838903, -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]],



       [[[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]],


        [[[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]],

         [[-1.037414 , -1.037414 ],
          [-1.037414 , -1.037414 ]]]]],




      [[[[[-1.099914 , -1.099914 ],
          [-1.099914 , -0.7298399]],

         [[-2.2463903, -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]],



       [[[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]],


        [[[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]],

         [[-1.099914 , -1.099914 ],
          [-1.099914 , -1.099914 ]]]]],




      [[[[[-1.162414 , -1.162414 ],
          [-1.162414 , -0.7923399]],

         [[-0.2463904, -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]],



       [[[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]],


        [[[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]],

         [[-1.162414 , -1.162414 ],
          [-1.162414 , -1.162414 ]]]]]]]

test_cc_sce_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    1.3496118

test_cc_sce_mean_3d

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]

Outputs:
  loss: shape=(), dtype=float32
    1.9446813

test_cc_sce_mean_3d_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]

Outputs:
  loss: shape=(), dtype=float32
    1.9446813
  log_prob: shape=(3, 5, 2), dtype=float32
    [[[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]],

     [[-1.8522898, -1.50635  ],
      [-1.6022898, -1.25635  ],
      [-1.3522898, -1.00635  ],
      [-1.1022898, -2.88135  ],
      [-2.9772897, -2.63135  ]],

     [[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]]]

test_cc_sce_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    1.3496118
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_mean_no_weight_ii

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    1.5009037

test_cc_sce_mean_no_weight_ii_3d

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]

Outputs:
  loss: shape=(), dtype=float32
    1.831466

test_cc_sce_mean_no_weight_ii_3d_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]

Outputs:
  loss: shape=(), dtype=float32
    1.831466
  log_prob: shape=(3, 5, 2), dtype=float32
    [[[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]],

     [[-1.8522898, -1.50635  ],
      [-1.6022898, -1.25635  ],
      [-1.3522898, -1.00635  ],
      [-1.1022898, -2.88135  ],
      [-2.9772897, -2.63135  ]],

     [[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]]]

test_cc_sce_mean_no_weight_ii_4d

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(2, 4, 2, 2), dtype=float32
    [[[[-0.5  , -0.375],
       [-0.25 , -0.125]],

      [[ 0.   ,  0.125],
       [ 0.25 ,  0.375]],

      [[ 0.5  ,  0.625],
       [ 0.75 ,  0.875]],

      [[ 1.   ,  1.125],
       [ 1.25 ,  1.375]]],


     [[[ 1.5  , -0.5  ],
       [-0.375, -0.25 ]],

      [[-0.125,  0.   ],
       [ 0.125,  0.25 ]],

      [[ 0.375,  0.5  ],
       [ 0.625,  0.75 ]],

      [[ 0.875,  1.   ],
       [ 1.125,  1.25 ]]]]
  labels: shape=(2, 2, 2), dtype=int64
    [[[0, 1],
      [2, 3]],

     [[0, 1],
      [2, 3]]]

Outputs:
  loss: shape=(), dtype=float32
    1.2873387

test_cc_sce_mean_no_weight_ii_4d_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(2, 4, 2, 2), dtype=float32
    [[[[-0.5  , -0.375],
       [-0.25 , -0.125]],

      [[ 0.   ,  0.125],
       [ 0.25 ,  0.375]],

      [[ 0.5  ,  0.625],
       [ 0.75 ,  0.875]],

      [[ 1.   ,  1.125],
       [ 1.25 ,  1.375]]],


     [[[ 1.5  , -0.5  ],
       [-0.375, -0.25 ]],

      [[-0.125,  0.   ],
       [ 0.125,  0.25 ]],

      [[ 0.375,  0.5  ],
       [ 0.625,  0.75 ]],

      [[ 0.875,  1.   ],
       [ 1.125,  1.25 ]]]]
  labels: shape=(2, 2, 2), dtype=int64
    [[[0, 1],
      [2, 3]],

     [[0, 1],
      [2, 3]]]

Outputs:
  loss: shape=(), dtype=float32
    1.2873387
  log_prob: shape=(2, 4, 2, 2), dtype=float32
    [[[[-2.2873387 , -2.2873387 ],
       [-2.2873387 , -2.2873387 ]],

      [[-1.7873387 , -1.7873387 ],
       [-1.7873387 , -1.7873387 ]],

      [[-1.2873387 , -1.2873387 ],
       [-1.2873387 , -1.2873387 ]],

      [[-0.7873387 , -0.7873387 ],
       [-0.7873387 , -0.7873387 ]]],


     [[[-0.72116387, -2.2873387 ],
       [-2.2873387 , -2.2873387 ]],

      [[-2.3461637 , -1.7873387 ],
       [-1.7873387 , -1.7873387 ]],

      [[-1.8461639 , -1.2873387 ],
       [-1.2873387 , -1.2873387 ]],

      [[-1.3461639 , -0.7873387 ],
       [-0.7873387 , -0.7873387 ]]]]

test_cc_sce_mean_no_weight_ii_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    1.5009037
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_mean_weight

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.440193

test_cc_sce_mean_weight_ii

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.5116776

test_cc_sce_mean_weight_ii_3d

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.507599

test_cc_sce_mean_weight_ii_3d_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5, 2), dtype=float32
    [[[-0.5  , -0.375],
      [-0.25 , -0.125],
      [ 0.   ,  0.125],
      [ 0.25 ,  0.375],
      [ 0.5  ,  0.625]],

     [[ 0.75 ,  0.875],
      [ 1.   ,  1.125],
      [ 1.25 ,  1.375],
      [ 1.5  , -0.5  ],
      [-0.375, -0.25 ]],

     [[-0.125,  0.   ],
      [ 0.125,  0.25 ],
      [ 0.375,  0.5  ],
      [ 0.625,  0.75 ],
      [ 0.875,  1.   ]]]
  labels: shape=(3, 2), dtype=int64
    [[0, 1],
     [2, 3],
     [4, 0]]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.507599
  log_prob: shape=(3, 5, 2), dtype=float32
    [[[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]],

     [[-1.8522898, -1.50635  ],
      [-1.6022898, -1.25635  ],
      [-1.3522898, -1.00635  ],
      [-1.1022898, -2.88135  ],
      [-2.9772897, -2.63135  ]],

     [[-2.171112 , -2.171112 ],
      [-1.921112 , -1.921112 ],
      [-1.671112 , -1.671112 ],
      [-1.421112 , -1.421112 ],
      [-1.171112 , -1.171112 ]]]

test_cc_sce_mean_weight_ii_4d

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(2, 4, 2, 2), dtype=float32
    [[[[-0.5  , -0.375],
       [-0.25 , -0.125]],

      [[ 0.   ,  0.125],
       [ 0.25 ,  0.375]],

      [[ 0.5  ,  0.625],
       [ 0.75 ,  0.875]],

      [[ 1.   ,  1.125],
       [ 1.25 ,  1.375]]],


     [[[ 1.5  , -0.5  ],
       [-0.375, -0.25 ]],

      [[-0.125,  0.   ],
       [ 0.125,  0.25 ]],

      [[ 0.375,  0.5  ],
       [ 0.625,  0.75 ]],

      [[ 0.875,  1.   ],
       [ 1.125,  1.25 ]]]]
  labels: shape=(2, 2, 2), dtype=int64
    [[[0, 1],
      [2, 3]],

     [[0, 1],
      [2, 3]]]
  weights: shape=(4,), dtype=float32
    [0.2, 0.3, 0.6, 0.1]

Outputs:
  loss: shape=(), dtype=float32
    1.3873389

test_cc_sce_mean_weight_ii_4d_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(2, 4, 2, 2), dtype=float32
    [[[[-0.5  , -0.375],
       [-0.25 , -0.125]],

      [[ 0.   ,  0.125],
       [ 0.25 ,  0.375]],

      [[ 0.5  ,  0.625],
       [ 0.75 ,  0.875]],

      [[ 1.   ,  1.125],
       [ 1.25 ,  1.375]]],


     [[[ 1.5  , -0.5  ],
       [-0.375, -0.25 ]],

      [[-0.125,  0.   ],
       [ 0.125,  0.25 ]],

      [[ 0.375,  0.5  ],
       [ 0.625,  0.75 ]],

      [[ 0.875,  1.   ],
       [ 1.125,  1.25 ]]]]
  labels: shape=(2, 2, 2), dtype=int64
    [[[0, 1],
      [2, 3]],

     [[0, 1],
      [2, 3]]]
  weights: shape=(4,), dtype=float32
    [0.2, 0.3, 0.6, 0.1]

Outputs:
  loss: shape=(), dtype=float32
    1.3873389
  log_prob: shape=(2, 4, 2, 2), dtype=float32
    [[[[-2.2873387 , -2.2873387 ],
       [-2.2873387 , -2.2873387 ]],

      [[-1.7873387 , -1.7873387 ],
       [-1.7873387 , -1.7873387 ]],

      [[-1.2873387 , -1.2873387 ],
       [-1.2873387 , -1.2873387 ]],

      [[-0.7873387 , -0.7873387 ],
       [-0.7873387 , -0.7873387 ]]],


     [[[-0.72116387, -2.2873387 ],
       [-2.2873387 , -2.2873387 ]],

      [[-2.3461637 , -1.7873387 ],
       [-1.7873387 , -1.7873387 ]],

      [[-1.8461639 , -1.2873387 ],
       [-1.2873387 , -1.2873387 ]],

      [[-1.3461639 , -0.7873387 ],
       [-0.7873387 , -0.7873387 ]]]]

test_cc_sce_mean_weight_ii_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
    ignore_index = 0
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.5116776
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_mean_weight_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(), dtype=float32
    1.440193
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(3,), dtype=float32
    [1.6194162, 1.0470278, 1.3823912]

test_cc_sce_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(3,), dtype=float32
    [1.6194162, 1.0470278, 1.3823912]
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_none_weights

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(3,), dtype=float32
    [0.97164977, 0.20940557, 0.6911956 ]

test_cc_sce_none_weights_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  loss: shape=(3,), dtype=float32
    [0.97164977, 0.20940557, 0.6911956 ]
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_sce_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    4.0488353

test_cc_sce_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  loss: shape=(), dtype=float32
    4.0488353
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_softmax_cross_entropy_loss_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (output, log_prob)
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  output: shape=(), dtype=float32
    1.3496118
  log_prob: shape=(3, 5), dtype=float32
    [[-1.8194163, -1.7194164, -1.6194162, -1.5194163, -1.4194163],
     [-1.0470278, -1.5470278, -1.8470278, -1.9470278, -1.9970279],
     [-2.3823915, -1.8823912, -1.4823914, -1.2823913, -1.3823912]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_mean_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [32768, 32768, 32768, ..., 32768, 32768, 32768]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_mean_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [32768, 32768, 32768, ..., 32768, 32768, 32768]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(2,), dtype=bfloat16
    [11.0625, 11.0625]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(2,), dtype=bfloat16
    [11.0625, 11.0625]
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_none_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(2,), dtype=bfloat16
    [5.53125, 5.53125]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_none_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(2,), dtype=bfloat16
    [5.53125, 5.53125]
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=bfloat16
    22.125

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=bfloat16
    22.125
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_sum_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625

test_cc_softmax_cross_entropy_loss_many_classes_bfloat16_sum_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=bfloat16
    [[0, 0, 0, ..., 0, 0, 0],
     [0, 0, 0, ..., 0, 0, 0]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=bfloat16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(), dtype=bfloat16
    11.0625
  log_prob: shape=(2, 65536), dtype=bfloat16
    [[-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625],
     [-11.0625, -11.0625, -11.0625, ..., -11.0625, -11.0625, -11.0625]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=float16
    11.09

test_cc_softmax_cross_entropy_loss_many_classes_float16_mean_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=float16
    11.09
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_mean_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [3.277e+04, 3.277e+04, 3.277e+04, ..., 3.277e+04, 3.277e+04, 3.277e+04]

Outputs:
  loss: shape=(), dtype=float16
    11.09

test_cc_softmax_cross_entropy_loss_many_classes_float16_mean_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "mean"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [3.277e+04, 3.277e+04, 3.277e+04, ..., 3.277e+04, 3.277e+04, 3.277e+04]

Outputs:
  loss: shape=(), dtype=float16
    11.09
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(2,), dtype=float16
    [11.09, 11.09]

test_cc_softmax_cross_entropy_loss_many_classes_float16_none_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(2,), dtype=float16
    [11.09, 11.09]
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_none_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(2,), dtype=float16
    [5.547, 5.547]

test_cc_softmax_cross_entropy_loss_many_classes_float16_none_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(2,), dtype=float16
    [5.547, 5.547]
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=float16
    22.19

test_cc_softmax_cross_entropy_loss_many_classes_float16_sum_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]

Outputs:
  loss: shape=(), dtype=float16
    22.19
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_many_classes_float16_sum_weighted

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(), dtype=float16
    11.09

test_cc_softmax_cross_entropy_loss_many_classes_float16_sum_weighted_log_prob

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (loss, log_prob)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(2, 65536), dtype=float16
    [[0., 0., 0., ..., 0., 0., 0.],
     [0., 0., 0., ..., 0., 0., 0.]]
  labels: shape=(2,), dtype=int64
    [    0, 65535]
  weights: shape=(65536,), dtype=float16
    [0.5, 0.5, 0.5, ..., 0.5, 0.5, 0.5]

Outputs:
  loss: shape=(), dtype=float16
    11.09
  log_prob: shape=(2, 65536), dtype=float16
    [[-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09],
     [-11.09, -11.09, -11.09, ..., -11.09, -11.09, -11.09]]

test_cc_softmax_cross_entropy_loss_mean

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (output)
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  output: shape=(), dtype=float32
    1.3496118

test_cc_softmax_cross_entropy_loss_none

Node:
  SoftmaxCrossEntropyLoss(scores, labels) -> (output)
  Attributes:
    reduction = "none"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]

Outputs:
  output: shape=(3,), dtype=float32
    [1.6194162, 1.0470278, 1.3823912]

test_cc_softmax_cross_entropy_loss_weighted_sum

Node:
  SoftmaxCrossEntropyLoss(scores, labels, weights) -> (output)
  Attributes:
    reduction = "sum"
Inputs:
  scores: shape=(3, 5), dtype=float32
    [[ 0.1 ,  0.2 ,  0.3 ,  0.4 ,  0.5 ],
     [ 1.  ,  0.5 ,  0.2 ,  0.1 ,  0.05],
     [-0.2 ,  0.3 ,  0.7 ,  0.9 ,  0.8 ]]
  labels: shape=(3,), dtype=int64
    [2, 0, 4]
  weights: shape=(5,), dtype=float32
    [0.2, 0.3, 0.6, 0.1, 0.5]

Outputs:
  output: shape=(), dtype=float32
    1.8722509

Differences with previous version (12)#

SchemaDiff: SoftmaxCrossEntropyLoss (domain 'ai.onnx')

  • old version: 12

  • new version: 13

  • breaking: no

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Documentation:

  • line similarity: 0.48 (+23/-14 lines)

--- SoftmaxCrossEntropyLoss v12
+++ SoftmaxCrossEntropyLoss v13
@@ -6,26 +6,35 @@
 the loss tensor L may have (N, D1, D2, ..., Dk) as its shape and L[i,][j_1][j_2]...[j_k] denotes a scalar element in L.
 After L is available, this operator can optionally do a reduction operator.

-shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk),
-        with K >= 1 in case of K-dimensional loss.
-shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk),
-        with K >= 1 in case of K-dimensional loss.
+* shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk),
+  with K >= 1 in case of K-dimensional loss.
+* shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk),
+  with K >= 1 in case of K-dimensional loss.

 The loss for one sample, l_i, can calculated as follows:
-    l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes.
+```
+l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes.
+```
 or
-    l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided.
+```
+l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided.
+```

 loss is zero for the case when label-value equals ignore_index.
-    l[i][d1][d2]...[dk]  = 0, when labels[n][d1][d2]...[dk] = ignore_index
+```
+l[i][d1][d2]...[dk]  = 0, when labels[n][d1][d2]...[dk] = ignore_index
+```

 where:
-    p = Softmax(scores)
-    y = Log(p)
-    c = labels[i][d1][d2]...[dk]
+```
+p = Softmax(scores)
+y = Log(p)
+c = labels[i][d1][d2]...[dk]
+```

 Finally, L is optionally reduced:
-If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk).
-If reduction = 'sum', the output is scalar: Sum(L).
-If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: ReduceSum(L) / ReduceSum(W),
-where tensor W is of shape (N, D1, D2, ..., Dk) and W[n][d1][d2]...[dk] = weights[labels[i][d1][d2]...[dk]].
+
+* If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk).
+* If reduction = 'sum', the output is scalar: Sum(L).
+* If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: `ReduceSum(L) / ReduceSum(W)`,
+  where tensor W is of shape `(N, D1, D2, ..., Dk)` and `W[n][d1][d2]...[dk] = weights[labels[i][d1][d2]...[dk]]`.

Version History#