| 92 | } |
| 93 | |
| 94 | CompNode mgb::imperative::get_tensor_device(const DLDevice& ctx, int stream) { |
| 95 | int id = ctx.device_id; |
| 96 | switch (ctx.device_type) { |
| 97 | case DLDeviceType::kDLCPU: { |
| 98 | auto device = "cpu" + std::to_string(id); |
| 99 | return as_comp_node(device); |
| 100 | } |
| 101 | case DLDeviceType::kDLCUDA: { |
| 102 | auto device = "gpu" + std::to_string(id) + ":" + std::to_string(stream); |
| 103 | return as_comp_node(device); |
| 104 | } |
| 105 | default: |
| 106 | mgb_throw(MegBrainError, "Unsupported device_type"); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | DType mgb::imperative::get_tensor_type(const DLDataType& dtype) { |
| 111 | DType tensortype; |
nothing calls this directly
no test coverage detected