MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SoftmaxCrossEntropyWithLogits

Function SoftmaxCrossEntropyWithLogits

tensorflow/go/op/wrappers.go:24228–24240  ·  view source on GitHub ↗

Computes softmax cross entropy cost and gradients to backpropagate. Inputs are the logits, not probabilities. Arguments: features: batch_size x num_classes matrix labels: batch_size x num_classes matrix The caller must ensure that each batch of labels represents a valid probability distribution.

(scope *Scope, features tf.Output, labels tf.Output)

Source from the content-addressed store, hash-verified

24226//
24227// Returns Per example loss (batch_size vector).backpropagated gradients (batch_size x num_classes matrix).
24228func SoftmaxCrossEntropyWithLogits(scope *Scope, features tf.Output, labels tf.Output) (loss tf.Output, backprop tf.Output) {
24229 if scope.Err() != nil {
24230 return
24231 }
24232 opspec := tf.OpSpec{
24233 Type: "SoftmaxCrossEntropyWithLogits",
24234 Input: []tf.Input{
24235 features, labels,
24236 },
24237 }
24238 op := scope.AddOperation(opspec)
24239 return op.Output(0), op.Output(1)
24240}
24241
24242// Debugging/model interpretability outputs for each example.
24243//

Callers 1

TEST_FFunction · 0.85

Calls 3

ErrMethod · 0.45
AddOperationMethod · 0.45
OutputMethod · 0.45

Tested by 1

TEST_FFunction · 0.68