def num_samples(self):
        """
        Return the total number of samples.
        """
        with self.container.open_if_needed(mode='r') as cnt:
            return cnt.get(self.key)[0].shape[0]
Return the total number of samples.