| 54 | } |
| 55 | |
| 56 | int LITE_make_tensor(const LiteTensorDesc tensor_describe, LiteTensor* tensor) { |
| 57 | LITE_CAPI_BEGIN(); |
| 58 | LITE_ASSERT(tensor, "The tensor pass to LITE_make_tensor is null"); |
| 59 | lite::Layout layout = convert_to_layout(tensor_describe.layout); |
| 60 | auto lite_tensor = std::make_shared<lite::Tensor>( |
| 61 | tensor_describe.device_id, tensor_describe.device_type, layout, |
| 62 | tensor_describe.is_pinned_host); |
| 63 | { |
| 64 | LITE_LOCK_GUARD(mtx_tensor); |
| 65 | get_global_tensor_holder()[lite_tensor.get()] = lite_tensor; |
| 66 | } |
| 67 | *tensor = lite_tensor.get(); |
| 68 | LITE_CAPI_END(); |
| 69 | } |
| 70 | |
| 71 | int LITE_destroy_tensor(LiteTensor tensor) { |
| 72 | LITE_CAPI_BEGIN(); |