# tensorflow::ops::SparseFillEmptyRows Class Reference

# tensorflow::
ops::
SparseFillEmptyRows

`
#include <sparse_ops.h>
`


Fills empty rows in the input 2-D
`
SparseTensor
`
with a default value.

## Summary


The input
`
SparseTensor
`
is represented via the tuple of inputs (
`
indices
`
,
`
values
`
,
`
dense_shape
`
). The output
`
SparseTensor
`
has the same
`
dense_shape
`
but with indices
`
output_indices
`
and values
`
output_values
`
.


This op inserts a single entry for every row that doesn't have any values. The index is created as
`
[row, 0, ..., 0]
`
and the inserted value is
`
default_value
`
.


For example, suppose
`
sp_input
`
has shape
`
[5, 6]
`
and non-empty values:

```
[0, 1]: a
[0, 3]: b
[2, 0]: c
[3, 1]: d
```

<br />


Rows 1 and 4 are empty, so the output will be of shape
`
[5, 6]
`
with values:

```
[0, 1]: a
[0, 3]: b
[1, 0]: default_value
[2, 0]: c
[3, 1]: d
[4, 0]: default_value
```

<br />


The output
`
SparseTensor
`
will be in row-major order and will have the same shape as the input.


This op also returns an indicator vector shaped
`
[dense_shape[0]]
`
such that

```
empty_row_indicator[i] = True iff row i was an empty row.
```

<br />


And a reverse index map vector shaped
`
[indices.shape[0]]
`
that is used during backpropagation,

```
reverse_index_map[j] = out_j s.t. indices[j, :] == output_indices[out_j, :]
```

<br />


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- indices: 2-D. the indices of the sparse tensor.
- values: 1-D. the values of the sparse tensor.
- dense_shape: 1-D. the shape of the sparse tensor.
- default_value: 0-D. default value to insert into location `
  [row, 0, ..., 0]
  ` for rows missing from the input sparse tensor. output indices: 2-D. the indices of the filled sparse tensor.

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` output_indices
- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` output_values: 1-D. the values of the filled sparse tensor.
- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` empty_row_indicator: 1-D. whether the dense row was missing in the input sparse tensor.
- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` reverse_index_map: 1-D. a map from the input indices to the output indices.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1a879e72f00ec2907ae24319568619e724 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input indices, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input values, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input dense_shape, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input default_value) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1adb1b94f12679619031e52393d4dde736 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1a904fc23a9366dfb3edb6e9ce97f51176 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1a2e77eb808d738a81625bc66d14e269c2 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1a050f6a03931adf4b1fe9fe0933537d4f ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-fill-empty-rows#classtensorflow_1_1ops_1_1_sparse_fill_empty_rows_1af0519edc8137614dd36f96f10ed6e4ef ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

## Public attributes

### empty_row_indicator

```
::tensorflow::Output empty_row_indicator
```

### operation

```
Operation operation
```

### output_indices

```
::tensorflow::Output output_indices
```

### output_values

```
::tensorflow::Output output_values
```

### reverse_index_map

```
::tensorflow::Output reverse_index_map
```

## Public functions

### SparseFillEmptyRows

```
 SparseFillEmptyRows(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input indices,
  ::tensorflow::Input values,
  ::tensorflow::Input dense_shape,
  ::tensorflow::Input default_value
)
```