تدفق التوتر:: العمليات:: SparseSoftmaxCrossEntropyWithLogits
#include <nn_ops.h>
يحسب softmax تكلفة الانتروبيا المتقاطعة والتدرجات للانتشار العكسي.
ملخص
على عكس SoftmaxCrossEntropyWithLogits
، لا تقبل هذه العملية مصفوفة من احتمالات التسمية، بل تقبل تسمية واحدة لكل صف من الميزات. تعتبر هذه التسمية ذات احتمالية 1.0 للصف المحدد.
المدخلات هي اللوغاريتمات، وليس الاحتمالات.
الحجج:
- النطاق: كائن النطاق
- الميزات: مصفوفة Batch_size × num_classes
- التسميات: ناقل Batch_size بقيم في [0، num_classes). هذه هي التسمية الخاصة بإدخال الدفعة الصغيرة المحدد.
العوائد:
- خسارة
Output
: خسارة لكل مثال (ناقل الدفعة_حجم). - دعامة خلفية
Output
: تدرجات ذات انتشار خلفي (مصفوفة حجم الدفعة × عدد الفئات).
البنائين والمدمرين | |
---|---|
SparseSoftmaxCrossEntropyWithLogits (const :: tensorflow::Scope & scope, :: tensorflow::Input features, :: tensorflow::Input labels) |
الصفات العامة | |
---|---|
backprop | |
loss | |
operation |
الصفات العامة
backprop
::tensorflow::Output backprop
خسارة
::tensorflow::Output loss
عملية
Operation operation
الوظائف العامة
SparseSoftmaxCrossEntropyWithLogits
SparseSoftmaxCrossEntropyWithLogits( const ::tensorflow::Scope & scope, ::tensorflow::Input features, ::tensorflow::Input labels )
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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](/versions/r2.1/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\nArguments:\n\n- scope: A [Scope](/versions/r2.1/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](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) loss: Per example loss (batch_size vector).\n- [Output](/versions/r2.1/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](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` features, ::`[tensorflow::Input](/versions/r2.1/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](/versions/r2.1/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](/versions/r2.1/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](/versions/r2.1/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```"]]