| 125 | } |
| 126 | |
| 127 | Status VariantDeviceCopy( |
| 128 | const VariantDeviceCopyDirection direction, const Variant& from, |
| 129 | Variant* to, |
| 130 | const UnaryVariantOpRegistry::AsyncTensorDeviceCopyFn& copy_fn) { |
| 131 | UnaryVariantOpRegistry::AsyncVariantDeviceCopyFn* device_copy_fn = |
| 132 | UnaryVariantOpRegistry::Global()->GetDeviceCopyFn(direction, |
| 133 | from.TypeId()); |
| 134 | if (device_copy_fn == nullptr) { |
| 135 | return errors::Internal( |
| 136 | "No unary variant device copy function found for direction: ", |
| 137 | direction, " and Variant type_index: ", |
| 138 | port::MaybeAbiDemangle(from.TypeId().name())); |
| 139 | } |
| 140 | return (*device_copy_fn)(from, to, copy_fn); |
| 141 | } |
| 142 | |
| 143 | namespace { |
| 144 | template <typename T> |
no test coverage detected