Registration is open for TensorFlow Dev Summit 2020 Learn more

tfio.experimental.IOTensor

View source on GitHub

Class IOTensor

IOTensor

Inherits From: IOTensor

__init__

View source

__init__(
    spec,
    internal=False
)

Initialize self. See help(type(self)) for accurate signature.

Properties

spec

The TensorSpec of values in this tensor.

Methods

from_audio

View source

from_audio(
    cls,
    filename,
    **kwargs
)

Creates an IOTensor from an audio file.

The following audio file formats are supported:

  • WAV
  • OGG

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

from_avro(
    cls,
    filename,
    schema,
    **kwargs
)

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

from_csv(
    cls,
    filename,
    **kwargs
)

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

@classmethod
from_exr(
    cls,
    filename,
    **kwargs
)

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

from_feather(
    cls,
    filename,
    **kwargs
)

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

from_ffmpeg(
    cls,
    filename,
    **kwargs
)

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

from_hdf5(
    cls,
    filename,
    **kwargs
)

Creates an IOTensor from an hdf5 file.

Args:

  • filename: A string, the filename of an hdf5 file.
  • name: A name prefix for the IOTensor (optional).

Returns:

A IOTensor.

from_json

View source

from_json(
    cls,
    filename,
    **kwargs
)

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

from_kafka(
    cls,
    topic,
    partition=0,
    offset=0,
    tail=-1,
    **kwargs
)

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.
  • offset: A tf.int64 tensor containing the start offset, by default 0.
  • tail: A tf.int64 tensor containing the end offset, by default -1.
  • 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"] Dataset configuration: there are two configurations available, conf.eof=0|1: if True, the KafkaDaset will stop on EOF (default). conf.timeout=milliseconds: timeout value for Kafka Consumer to wait.
  • name: A name prefix for the IOTensor (optional).

Returns:

A IOTensor.

from_lmdb

View source

from_lmdb(
    cls,
    filename,
    **kwargs
)

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

from_parquet(
    cls,
    filename,
    **kwargs
)

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

from_tensor(
    cls,
    tensor,
    **kwargs
)

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

from_tiff(
    cls,
    filename,
    **kwargs
)

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

graph(
    cls,
    dtype
)

Obtain a GraphIOTensor to be used in graph mode.

Args:

  • dtype: Data type of the GraphIOTensor.

Returns:

A class of GraphIOTensor.