# tf.contrib.linear_optimizer.SparseFeatureColumn

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/linear_optimizer/python/ops/sparse_feature_column.py#L32-L132) |

Represents a sparse feature column.

    tf.contrib.linear_optimizer.SparseFeatureColumn(
        example_indices, feature_indices, feature_values
    )

Contains three tensors representing a sparse feature column, they are
example indices (`int64`), feature indices (`int64`), and feature
values (`float`).
Feature weights are optional, and are treated as `1.0f` if missing.

For example, consider a batch of 4 examples, which contains the following
features in a particular `SparseFeatureColumn`:

- Example 0: feature 5, value 1
- Example 1: feature 6, value 1 and feature 10, value 0.5
- Example 2: no features
- Example 3: two copies of feature 2, value 1

This SparseFeatureColumn will be represented as follows:

     <0, 5,  1>
     <1, 6,  1>
     <1, 10, 0.5>
     <3, 2,  1>
     <3, 2,  1>

For a batch of 2 examples below:

- Example 0: feature 5
- Example 1: feature 6

is represented by `SparseFeatureColumn` as:

     <0, 5,  1>
     <1, 6,  1>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `example_indices` | A 1-D int64 tensor of shape `[N]`. Also, accepts python lists, or numpy arrays. |
| `feature_indices` | A 1-D int64 tensor of shape `[N]`. Also, accepts python lists, or numpy arrays. |
| `feature_values` | An optional 1-D tensor float tensor of shape `[N]`. Also, accepts python lists, or numpy arrays. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `example_indices` | The example indices represented as a dense tensor. |
| `feature_indices` | The feature indices represented as a dense tensor. |
| `feature_values` | The feature values represented as a dense tensor. |

<br />