xref: /aosp_15_r20/external/executorch/backends/vulkan/runtime/graph/containers/Constant.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <executorch/backends/vulkan/runtime/api/Context.h>
12 
13 namespace vkcompute {
14 
15 /*
16  * Represents a reference to a tensor that has been
17  * serialized with the model, such as a serialized weight
18  * tensor. It contains some metadata as well as a raw
19  * pointer to the data of the tensor, which is assumed to
20  * be contiguous.
21  */
22 struct TensorRef final {
23   std::vector<int64_t> sizes;
24   vkapi::ScalarType dtype;
25   const void* data;
26 
27   explicit TensorRef(
28       const std::vector<int64_t>& t_sizes,
29       vkapi::ScalarType t_dtype,
30       const void* const t_data);
31 };
32 
33 } // namespace vkcompute
34