جریان تنسور:: عملیات:: SparseMatMul
#include <math_ops.h>
ماتریس "a" را در ماتریس "ب" ضرب کنید .
خلاصه
ورودی ها باید ماتریس های دو بعدی باشند و بعد داخلی "a" باید با بعد بیرونی "b" مطابقت داشته باشد. هر دو "a" و "b" باید Tensor
s باشند نه SparseTensor
s. این عملیات برای مواردی بهینه شده است که حداقل یکی از "a" یا "b" پراکنده باشد، به این معنا که نسبت زیادی از مقادیر صفر دارند. نقطه سر به سر استفاده از این در مقابل ضرب ماتریس متراکم در یک پلت فرم، 30 درصد مقادیر صفر در ماتریس پراکنده بود.
محاسبه گرادیان این عملیات تنها زمانی از پراکندگی در گرادیان ورودی استفاده می کند که آن گرادیان از یک Relu باشد.
استدلال ها:
برمیگرداند:
صفات عمومی
عملیات
Operation operation
محصول
::tensorflow::Output product
توابع عمومی
SparseMatMul
SparseMatMul(
const ::tensorflow::Scope & scope,
::tensorflow::Input a,
::tensorflow::Input b
)
SparseMatMul
SparseMatMul(
const ::tensorflow::Scope & scope,
::tensorflow::Input a,
::tensorflow::Input b,
const SparseMatMul::Attrs & attrs
)
گره
::tensorflow::Node * node() const
operator::tensorflow::Input() const
عملگر::tensorflow::خروجی
operator::tensorflow::Output() const
توابع استاتیک عمومی
AIsSparse
Attrs AIsSparse(
bool x
)
BIsSparse
Attrs BIsSparse(
bool x
)
TransposeA
Attrs TransposeA(
bool x
)
TransposeB
Attrs TransposeB(
bool x
)
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-27 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-27 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# tensorflow::ops::SparseMatMul Class Reference\n\ntensorflow::ops::SparseMatMul\n=============================\n\n`#include \u003cmath_ops.h\u003e`\n\n[Multiply](/versions/r2.2/api_docs/cc/class/tensorflow/ops/multiply#classtensorflow_1_1ops_1_1_multiply) matrix \"a\" by matrix \"b\".\n\nSummary\n-------\n\nThe inputs must be two-dimensional matrices and the inner dimension of \"a\" must match the outer dimension of \"b\". Both \"a\" and \"b\" must be [Tensor](/versions/r2.2/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor)s not `SparseTensor`s. This op is optimized for the case where at least one of \"a\" or \"b\" is sparse, in the sense that they have a large proportion of zero values. The breakeven for using this versus a dense matrix multiply on one platform was 30% zero values in the sparse matrix.\n\nThe gradient computation of this operation will only take advantage of sparsity in the input gradient when that gradient comes from a [Relu](/versions/r2.2/api_docs/cc/class/tensorflow/ops/relu#classtensorflow_1_1ops_1_1_relu).\n\nArguments:\n\n- scope: A [Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The product tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseMatMul](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a44ec3b9c8a4a6c27ec1e5defa921a8c2)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b)` ||\n| [SparseMatMul](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a29e8ca18f70b1f18d2d5931606fa5108)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b, const `[SparseMatMul::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs#structtensorflow_1_1ops_1_1_sparse_mat_mul_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1af4bedc3c3ba71553d0c1e30513898430) | [Operation](/versions/r2.2/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [product](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a9b708969f18250faa3e40edad285ae45) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1ae461c34d275e4d996e21af14b8870531)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a7e6d0d764e73510a120ea967abaf9250)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a3fee7729e51d2b640d654a25a84f0185)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [AIsSparse](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1acaa26e8e9d1e5854dcfef57dcb4efd5b)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs#structtensorflow_1_1ops_1_1_sparse_mat_mul_1_1_attrs) |\n| [BIsSparse](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1aaf87a4805b8269233969a514bea852ef)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs#structtensorflow_1_1ops_1_1_sparse_mat_mul_1_1_attrs) |\n| [TransposeA](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1a41b864162f17688227aa34ee4d8021b2)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs#structtensorflow_1_1ops_1_1_sparse_mat_mul_1_1_attrs) |\n| [TransposeB](#classtensorflow_1_1ops_1_1_sparse_mat_mul_1af58949ad4394aa0ba7869e65ba742487)`(bool x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs#structtensorflow_1_1ops_1_1_sparse_mat_mul_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::SparseMatMul::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs) | Optional attribute setters for [SparseMatMul](/versions/r2.2/api_docs/cc/class/tensorflow/ops/sparse-mat-mul#classtensorflow_1_1ops_1_1_sparse_mat_mul). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### product\n\n```text\n::tensorflow::Output product\n``` \n\nPublic functions\n----------------\n\n### SparseMatMul\n\n```gdscript\n SparseMatMul(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input a,\n ::tensorflow::Input b\n)\n``` \n\n### SparseMatMul\n\n```gdscript\n SparseMatMul(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input a,\n ::tensorflow::Input b,\n const SparseMatMul::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### AIsSparse\n\n```text\nAttrs AIsSparse(\n bool x\n)\n``` \n\n### BIsSparse\n\n```text\nAttrs BIsSparse(\n bool x\n)\n``` \n\n### TransposeA\n\n```text\nAttrs TransposeA(\n bool x\n)\n``` \n\n### TransposeB\n\n```text\nAttrs TransposeB(\n bool x\n)\n```"]]