Rate this Page

Define _TORCH_OPTIM_DESERIALIZE_TORCH_ARG#

Define Documentation#

_TORCH_OPTIM_DESERIALIZE_TORCH_ARG(T, name)   {                                                                        \     c10::IValue

ivalue;                                                    \

bool exists = archive.try_read(#name, ivalue);                         \

if (exists) {                                                          \

name(ivalue.to<T>());                                                \

} else {                                                               \

constexpr bool is_tensor_type = std::is_base_of_v<

torch::Tensor, T>; \       TORCH_INTERNAL_ASSERT

(is_tensor_type);                               \

}                                                                      \

}

#