Rate this Page

Define _TORCH_OPTIM_SERIALIZE_TORCH_ARG#

Define Documentation#

_TORCH_OPTIM_SERIALIZE_TORCH_ARG(name)

{                                                      \

auto ivalue = torch::IValue(name());                 \

/* do not serialize if name is an undefined tensor*/ \

if (!(ivalue.isTensor() &&                           \

ivalue.unsafeToTensorImpl() ==                 \

at::UndefinedTensorImpl::singleton())) {   \

archive.write(#name, ivalue);                      \

}                                                    \

}

#