def sample(self, trainer): x = trainer.updater.sample() x = x.data if cuda.available and isinstance(x, cuda.ndarray): x = cuda.to_cpu(x) return x