Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::SparseSoftmaxCrossEntropyWithLogits
#include <nn_ops.h>
Computes softmax cross entropy cost and gradients to backpropagate.
Summary
Unlike SoftmaxCrossEntropyWithLogits
, this operation does not accept a matrix of label probabilities, but rather a single label per row of features. This label is considered to have probability 1.0 for the given row.
Inputs are the logits, not probabilities.
Args:
- scope: A Scope object
- features: batch_size x num_classes matrix
- labels: batch_size vector with values in [0, num_classes). This is the label for the given minibatch entry.
Returns:
Output
loss: Per example loss (batch_size vector).
Output
backprop: backpropagated gradients (batch_size x num_classes matrix).
Public attributes
Public functions
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-11-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-15 UTC."],[],[],null,["# tensorflow::ops::SparseSoftmaxCrossEntropyWithLogits Class Reference\n\ntensorflow::ops::SparseSoftmaxCrossEntropyWithLogits\n====================================================\n\n`#include \u003cnn_ops.h\u003e`\n\nComputes softmax cross entropy cost and gradients to backpropagate.\n\nSummary\n-------\n\nUnlike [SoftmaxCrossEntropyWithLogits](/api_docs/cc/class/tensorflow/ops/softmax-cross-entropy-with-logits#classtensorflow_1_1ops_1_1_softmax_cross_entropy_with_logits), this operation does not accept a matrix of label probabilities, but rather a single label per row of features. This label is considered to have probability 1.0 for the given row.\n\nInputs are the logits, not probabilities.\n\nArgs:\n\n- scope: A [Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- features: batch_size x num_classes matrix\n- labels: batch_size vector with values in \\[0, num_classes). This is the label for the given minibatch entry.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) loss: Per example loss (batch_size vector).\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) backprop: backpropagated gradients (batch_size x num_classes matrix).\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseSoftmaxCrossEntropyWithLogits](#classtensorflow_1_1ops_1_1_sparse_softmax_cross_entropy_with_logits_1a965e868e103e3908d2bfb1dcd368e90d)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` features, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` labels)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [backprop](#classtensorflow_1_1ops_1_1_sparse_softmax_cross_entropy_with_logits_1a9e77b4f5efe0d0762f8fc95a3f7cdbaa) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [loss](#classtensorflow_1_1ops_1_1_sparse_softmax_cross_entropy_with_logits_1aa3c9d1b704d919039c2cd2686fbea683) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_sparse_softmax_cross_entropy_with_logits_1ac581285ea4e5d57f85d8f317aed838fa) | [Operation](/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\nPublic attributes\n-----------------\n\n### backprop\n\n```text\n::tensorflow::Output backprop\n``` \n\n### loss\n\n```text\n::tensorflow::Output loss\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### SparseSoftmaxCrossEntropyWithLogits\n\n```gdscript\n SparseSoftmaxCrossEntropyWithLogits(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input features,\n ::tensorflow::Input labels\n)\n```"]]