| 111 | } |
| 112 | |
| 113 | void UnaryVariantOpRegistry::RegisterDeviceCopyFn( |
| 114 | const VariantDeviceCopyDirection direction, const TypeIndex& type_index, |
| 115 | const AsyncVariantDeviceCopyFn& device_copy_fn) { |
| 116 | AsyncVariantDeviceCopyFn* existing = GetDeviceCopyFn(direction, type_index); |
| 117 | CHECK_EQ(existing, nullptr) |
| 118 | << "UnaryVariantDeviceCopy for direction: " << direction |
| 119 | << " and type_index: " << port::MaybeAbiDemangle(type_index.name()) |
| 120 | << " already registered"; |
| 121 | device_copy_fns.insert( |
| 122 | std::pair<std::pair<VariantDeviceCopyDirection, TypeIndex>, |
| 123 | AsyncVariantDeviceCopyFn>(std::make_pair(direction, type_index), |
| 124 | device_copy_fn)); |
| 125 | } |
| 126 | |
| 127 | Status VariantDeviceCopy( |
| 128 | const VariantDeviceCopyDirection direction, const Variant& from, |