Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfio.experimental.IOTensor

View source on GitHub

IOTensor

Inherits From: IOTensor

tfio.experimental.IOTensor(
    spec, internal=False
)

Attributes:

  • spec: The TensorSpec of values in this tensor.

Methods

from_arrow

View source

@classmethod
from_arrow(
    cls, table, **kwargs
)

Creates an IOTensor from a pyarrow.Table.

Args:

  • table: An instance of a pyarrow.Table.
  • name: A name prefix for the IOTensor (optional).

Returns:

A IOTensor.

from_audio

View source

@classmethod
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

@classmethod
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

@classmethod
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

@classmethod
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

@classmethod
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

@classmethod
from_hdf5(
    cls, filename, spec=None, **kwargs
)

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

@classmethod
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

@classmethod
from_kafka(
    cls, topic, partition=0, servers=None, configuration=None, **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.
  • 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

@classmethod
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

@classmethod
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

@classmethod
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

@classmethod
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

@classmethod
graph(
    cls, dtype
)

Obtain a GraphIOTensor to be used in graph mode.

Args:

  • dtype: Data type of the GraphIOTensor.

Returns:

A class of GraphIOTensor.