# tf.keras.utils.HDF5Matrix

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/utils/HDF5Matrix) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/utils/io_utils.py#L36-L166) |

Representation of HDF5 dataset to be used instead of a Numpy array.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.utils.HDF5Matrix`](https://www.tensorflow.org/api_docs/python/tf/keras/utils/HDF5Matrix), \`tf.compat.v2.keras.utils.HDF5Matrix\`

<br />

    tf.keras.utils.HDF5Matrix(
        datapath, dataset, start=0, end=None, normalizer=None
    )

#### Example:

        x_data = HDF5Matrix('input/file.hdf5', 'data')
        model.predict(x_data)

Providing `start` and `end` allows use of a slice of the dataset.

Optionally, a normalizer function (or lambda) can be given. This will
be called on every slice of data retrieved.

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `datapath` | string, path to a HDF5 file |
| `dataset` | string, name of the HDF5 dataset in the file specified in datapath |
| `start` | int, start of desired slice of the specified dataset |
| `end` | int, end of desired slice of the specified dataset |
| `normalizer` | function to be called on data when retrieved |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An array-like HDF5 dataset. ||

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `dtype` | Gets the datatype of the dataset. |
| `ndim` | Gets the number of dimensions (rank) of the dataset. |
| `shape` | Gets a numpy-style shape tuple giving the dataset dimensions. |
| `size` | Gets the total dataset size (number of elements). |

<br />

## Methods

### `__getitem__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/utils/io_utils.py#L85-L115)

    __getitem__(
        key
    )

### `__len__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/utils/io_utils.py#L82-L83)

    __len__()

## Class Variables

- `refs`