tfio.experimental.IOTensor

View source on GitHub

IOTensor

Inherits From: IOTensor

spec The TensorSpec of values in this tensor.

Methods

from_arrow

View source

Creates an IOTensor from a pyarrow.Table.

Args
table An instance of a pyarrow.Table.
spec A dict of dataset:tf.TensorSpec or dataset:dtype pairs that specify the dataset selected and the tf.TensorSpec or dtype of the dataset. In eager mode the spec is probed automatically. In graph mode spec is required and columns in the pyarrow.Table can be keyed by column name or index.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_audio

View source

Creates an IOTensor from an audio file.

The following audio file formats are supported:

  • WAV
  • Flac
  • Vorbis
  • MP3

Args
filename A string, the filename of an audio file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_avro

View source

Creates an IOTensor from an avro file.

Args
filename A string, the filename of an avro file.
schema A string, the schema of an avro file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_csv

View source

Creates an IOTensor from an csv file.

Args
filename A string, the filename of an csv file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_exr

View source

Creates an IOTensor from a OpenEXR file.

Args
filename A string, the filename of a OpenEXR file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_feather

View source

Creates an IOTensor from an feather file.

Args
filename A string, the filename of an feather file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_ffmpeg

View source

Creates an IOTensor from a audio/video file.

Args
filename A string, the filename of a audio/video file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_hdf5

View source

Creates an IOTensor from an hdf5 file.

Args
filename A string, the filename of an hdf5 file.
spec A dict of dataset:tf.TensorSpec or dataset:dtype pairs that specify the dataset selected and the tf.TensorSpec or dtype of the dataset. In eager mode the spec is probed automatically. In graph mode spec has to be specified.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_json

View source

Creates an IOTensor from an json file.

Args
filename A string, the filename of an json file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_kafka

View source

Creates an IOTensor from a Kafka stream.

Args
topic A tf.string tensor containing topic subscription.
partition A tf.int64 tensor containing the partition, by default 0.
servers An optional list of bootstrap servers, by default localhost:9092.
configuration An optional tf.string tensor containing configurations in [Key=Value] format. There are three types of configurations: Global configuration: please refer to 'Global configuration properties' in librdkafka doc. Examples include ["enable.auto.commit=false", "heartbeat.interval.ms=2000"] Topic configuration: please refer to 'Topic configuration properties' in librdkafka doc. Note all topic configurations should be prefixed with configuration.topic.. Examples include ["conf.topic.auto.offset.reset=earliest"]
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_lmdb

View source

Creates an IOTensor from a LMDB key/value store.

Args
filename A string, the filename of a LMDB file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_parquet

View source

Creates an IOTensor from a parquet file.

Args
filename A string, the filename of a parquet file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

from_tensor

View source

Converts a tf.Tensor into a IOTensor.

Examples:


Args
tensor The Tensor to convert.

Returns
A IOTensor.

Raises
ValueError If tensor is not a Tensor.

from_tiff

View source

Creates an IOTensor from a tiff file.

Note tiff file may consists of multiple images with different shapes.

Args
filename A string, the filename of a tiff file.
name A name prefix for the IOTensor (optional).

Returns
A IOTensor.

graph

View source

Obtain a GraphIOTensor to be used in graph mode.

Args
dtype Data type of the GraphIOTensor.

Returns
A class of GraphIOTensor.