def to_numpy(self, x): if isinstance(x, Variable) == True: x.to_cpu() x = x.data if isinstance(x, cuda.ndarray) == True: x = cuda.to_cpu(x) return x