# Buggy code
def create_virtual_dataset(self, name, layout, fillvalue=None):
    """Create a new virtual dataset in this group.

    See virtual datasets in the docs for more information.

    name
        (str) Name of the new dataset

    layout
        (VirtualLayout) Defines the sources for the virtual dataset

    fillvalue
        The value to use where there is no data.

    """
    from .vds import VDSmap

    # Encode filenames and dataset names appropriately.
    sources = []
    for vspace, file_name, dset_name, src_space in layout.sources:
        if file_name == self.file.filename:
            # use relative path if the source dataset is in the same
            # file, in order to keep the virtual dataset valid in case
            # the file is renamed.
            file_name = "."
        sources.append(
            VDSmap(vspace, filename_encode(file_name), self._e(dset_name), src_space)
        )

    with phil:
        group = self

        if name:
            if "/" in name:
                h5objects = [obj for obj in name.split("/") if len(obj)]
                name = h5objects[-1]
                h5objects = h5objects[:-1]

                for new_group in h5objects:
                    group = group.get(new_group) or group.create_group(new_group)

            name = self._e(name)

        dsid = dataset.make_new_virtual_dset(
            group,
            layout.shape,
            sources=sources,
            dtype=layout.dtype,
            name=name,
            maxshape=layout.maxshape,
            fillvalue=fillvalue,
        )

        dset = dataset.Dataset(dsid)

    return dset


# Traceback (TypeError)
Traceback (most recent call last):
File "test.py", line 5, in <module>
model.save('test.h5')
File "/Users/tgaddair/.venv/horovod/stable/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py", line 1171, in save
signatures)
File "/Users/tgaddair/.venv/horovod/stable/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py", line 109, in save_model
model, filepath, overwrite, include_optimizer)
File "/Users/tgaddair/.venv/horovod/stable/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 103, in save_model_to_hdf5
save_weights_to_hdf5_group(model_weights_group, model_layers)
File "/Users/tgaddair/.venv/horovod/stable/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 625, in save_weights_to_hdf5_group
param_dset = g.create_dataset(name, val.shape, dtype=val.dtype)
File "/Users/tgaddair/.venv/horovod/stable/lib/python3.7/site-packages/h5py/_hl/group.py", line 143, in create_dataset
if '/' in name:
TypeError: a bytes-like object is required, not 'str'

# Fixed code
def create_virtual_dataset(self, name, layout, fillvalue=None):
    """Create a new virtual dataset in this group.

    See virtual datasets in the docs for more information.

    name
        (str) Name of the new dataset

    layout
        (VirtualLayout) Defines the sources for the virtual dataset

    fillvalue
        The value to use where there is no data.

    """
    from .vds import VDSmap

    # Encode filenames and dataset names appropriately.
    sources = []
    for vspace, file_name, dset_name, src_space in layout.sources:
        if file_name == self.file.filename:
            # use relative path if the source dataset is in the same
            # file, in order to keep the virtual dataset valid in case
            # the file is renamed.
            file_name = "."
        sources.append(
            VDSmap(vspace, filename_encode(file_name), self._e(dset_name), src_space)
        )

    with phil:
        group = self

        if name:
            name = self._e(name)
            if b"/" in name.lstrip(b"/"):
                parent_path, name = name.rsplit(b"/", 1)
                group = self.require_group(parent_path)

        dsid = dataset.make_new_virtual_dset(
            group,
            layout.shape,
            sources=sources,
            dtype=layout.dtype,
            name=name,
            maxshape=layout.maxshape,
            fillvalue=fillvalue,
        )

        dset = dataset.Dataset(dsid)

    return dset