Tensorflow: Introducing A Matrix Of Different Size In A Placeholder
Solution 1:
The tf.placeholder()
op defines a placeholder for a dense tensor, so you must define all of the elements in the value that you are trying to feed.
An alternative (in the latest version of TensorFlow, available if you build from source or download a nightly release) is to use a tf.sparse_placeholder()
op, which allows you to feed a tf.SparseTensor
with a tf.SparseTensorValue
. This allows you to represent an object in which not all elements are defined, but the ones that are undefined are interpreted as zeros.
Note that TensorFlow's support for sparse data and variable-sized examples is still preliminary, and most of the operations—like tf.mul()
—are currently only defined for dense tensors. An alternative approach, which we use for variable-sized image data, is to process one (variable-sized) record at a time in an input pipeline, before converting it to a constant shape, and using the batching functions to make a single dense batch.
Post a Comment for "Tensorflow: Introducing A Matrix Of Different Size In A Placeholder"