LostTech.TensorFlow : API Documentation

Type SparseFeature

Namespace tensorflow

Parent PythonObjectContainer

Interfaces ISparseFeature

Configuration for parsing a sparse input feature from an `Example`.

Note, preferably use `VarLenFeature` (possibly in combination with a `SequenceExample`) in order to parse out `SparseTensor`s instead of `SparseFeature` due to its simplicity.

Closely mimicking the `SparseTensor` that will be obtained by parsing an `Example` with a `SparseFeature` config, a `SparseFeature` contains a

* `value_key`: The name of key for a `Feature` in the `Example` whose parsed `Tensor` will be the resulting `SparseTensor.values`.

* `index_key`: A list of names - one for each dimension in the resulting `SparseTensor` whose `indices[i][dim]` indicating the position of the `i`-th value in the `dim` dimension will be equal to the `i`-th value in the Feature with key named `index_key[dim]` in the `Example`.

* `size`: A list of ints for the resulting `SparseTensor.dense_shape`.

For example, we can represent the following 2D `SparseTensor` with an `Example` input proto and `SparseFeature` config with 2 `index_key`s
Show Example
SparseTensor(indices=[[3, 1], [20, 0]],
                         values=[0.5, -1.0]
                         dense_shape=[100, 3]) 

Properties

Public properties

object already_sorted get; set;

object dtype get; set;

object index_key get; set;

object PythonObject get;

object size get; set;

object value_key get; set;