# tensorflow::ops::AddSparseToTensorsMap

`#include <sparse_ops.h>`

[Add](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add#classtensorflow_1_1ops_1_1_add) a `SparseTensor` to a `SparseTensorsMap` return its handle.

## Summary

A `SparseTensor` is represented by three tensors: `sparse_indices`, `sparse_values`, and `sparse_shape`.

This operator takes the given `SparseTensor` and adds it to a container object (a `SparseTensorsMap`). A unique key within this container is generated in the form of an `int64`, and this is the value that is returned.

The `SparseTensor` can then be read out as part of a minibatch by passing the key as a vector element to `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/take-many-sparse-from-tensors-map#classtensorflow_1_1ops_1_1_take_many_sparse_from_tensors_map`. To ensure the correct `SparseTensorsMap` is accessed, ensure that the same `container` and `shared_name` are passed to that Op. If no `shared_name` is provided here, instead use the *name* of the [Operation](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) created by calling `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map` as the `shared_name` passed to `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/take-many-sparse-from-tensors-map#classtensorflow_1_1ops_1_1_take_many_sparse_from_tensors_map`. Ensure the Operations are colocated.

Arguments:

- scope: A [Scope](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- sparse_indices: 2-D. The `indices` of the `SparseTensor`.
- sparse_values: 1-D. The `values` of the `SparseTensor`.
- sparse_shape: 1-D. The `shape` of the `SparseTensor`.

<br />

Optional attributes (see `https://www.tensorflow.org/versions/r1.15/api_docs/cc/struct/tensorflow/ops/add-sparse-to-tensors-map/attrs#structtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1_1_attrs`):

- container: The container name for the `SparseTensorsMap` created by this op.
- shared_name: The shared name for the `SparseTensorsMap` created by this op. If blank, the new [Operation](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)'s unique name is used.

<br />

Returns:

- `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output`: 0-D. The handle of the `SparseTensor` now stored in the `SparseTensorsMap`.

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a19db933f8fd5d01db12d8b59d63bf06a(const ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_indices, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_values, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_shape)` ||
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1aff3889e43d0d729ad526a005889b5626(const ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_indices, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_values, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input sparse_shape, const https://www.tensorflow.org/versions/r1.15/api_docs/cc/struct/tensorflow/ops/add-sparse-to-tensors-map/attrs#structtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1_1_attrs & attrs)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a3c43523211fb26d79e4d22b5149c4029` | `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a48d455f05445afe51dff6364bb8968c8` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

| ### Public functions ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a416c237556b0e60bf15c9df4fcb04da1() const ` | `::tensorflow::Node *` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a02d4fe7f3659971c2cb8e26287ed407e() const ` | ` `` ` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a738ce7832c4e4854e1988426e9f3d0f7() const ` | ` `` ` |

| ### Public static functions ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1a8d3e3d5c6cf3b841ecbbc82322d94a89(StringPiece x)` | `https://www.tensorflow.org/versions/r1.15/api_docs/cc/struct/tensorflow/ops/add-sparse-to-tensors-map/attrs#structtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1_1_attrs` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1accd0cca1251e1cf70fe8c4d9498dd117(StringPiece x)` | `https://www.tensorflow.org/versions/r1.15/api_docs/cc/struct/tensorflow/ops/add-sparse-to-tensors-map/attrs#structtensorflow_1_1ops_1_1_add_sparse_to_tensors_map_1_1_attrs` |

| ### Structs ||
|---|---|
| [tensorflow::ops::AddSparseToTensorsMap::Attrs](https://www.tensorflow.org/versions/r1.15/api_docs/cc/struct/tensorflow/ops/add-sparse-to-tensors-map/attrs) | Optional attribute setters for [AddSparseToTensorsMap](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/add-sparse-to-tensors-map#classtensorflow_1_1ops_1_1_add_sparse_to_tensors_map). |

## Public attributes

### operation

```
Operation operation
```

### sparse_handle

```
::tensorflow::Output sparse_handle
```

## Public functions

### AddSparseToTensorsMap

```
 AddSparseToTensorsMap(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input sparse_indices,
  ::tensorflow::Input sparse_values,
  ::tensorflow::Input sparse_shape
)
```

### AddSparseToTensorsMap

```
 AddSparseToTensorsMap(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input sparse_indices,
  ::tensorflow::Input sparse_values,
  ::tensorflow::Input sparse_shape,
  const AddSparseToTensorsMap::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### Container

```
Attrs Container(
  StringPiece x
)
```

### SharedName

```
Attrs SharedName(
  StringPiece x
)
```