MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / LITE_make_tensor

Function LITE_make_tensor

lite/lite-c/src/tensor.cpp:56–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56int 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
71int LITE_destroy_tensor(LiteTensor tensor) {
72 LITE_CAPI_BEGIN();

Callers 1

TESTFunction · 0.85

Calls 2

convert_to_layoutFunction · 0.85
getMethod · 0.45

Tested by 1

TESTFunction · 0.68