return mean.sub(std2), mean.add(std2)
def cpu(self):
representation = self.representation()
if not isinstance(representation, tuple) or isinstance(representation, list):
representation = representation,
return self.__class__(*(var.cpu() for var in representation))
def cuda(self, device_id=None):
representation = self.representation()
After Change
new_args.append(arg)
for name, val in self._kwargs.items():
if hasattr(val, "cpu"):
new_kwargs[name] = val.cpu()
else:
new_kwargs[name] = val
return self.__class__(*new_args, **new_kwargs)