def __getitem__()

in sing/fondation/batch.py [0:0]


    def __getitem__(self, index):
        if isinstance(index, slice):
            if index.step is not None:
                raise IndexError("Does not support slice with step")
            metadata = self.metadata[index]
            tensors = {
                name: tensor[index]
                for name, tensor in self.tensors.items()
            }
            return Batch(metadata=metadata, tensors=tensors)
        else:
            return BatchItem(
                metadata=self.metadata[index],
                tensors={
                    name: tensor[index]
                    for name, tensor in self.tensors.items()
                })