Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::SparseMatMul
#include <math_ops.h>
Multiply matrix "a" by matrix "b".
Summary
The 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
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.
The gradient computation of this operation will only take advantage of sparsity in the input gradient when that gradient comes from a Relu.
Args:
Returns:
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
AIsSparse
Attrs AIsSparse(
bool x
)
BIsSparse
Attrs BIsSparse(
bool x
)
TransposeA
Attrs TransposeA(
bool x
)
TransposeB
Attrs TransposeB(
bool x
)
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 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::SparseMatMul Class Reference\n\ntensorflow::ops::SparseMatMul\n=============================\n\n`#include \u003cmath_ops.h\u003e`\n\n[Multiply](/versions/r2.14/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.14/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.14/api_docs/cc/class/tensorflow/ops/relu#classtensorflow_1_1ops_1_1_relu).\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/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.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a, ::`[tensorflow::Input](/versions/r2.14/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.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b, const `[SparseMatMul::Attrs](/versions/r2.14/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.14/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.14/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.14/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.14/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.14/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.14/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.14/api_docs/cc/struct/tensorflow/ops/sparse-mat-mul/attrs) | Optional attribute setters for [SparseMatMul](/versions/r2.14/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```"]]