// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include #include "core/common/basic_types.h" #include "core/common/inlined_containers_fwd.h" #include "core/framework/allocator.h" #include "core/framework/tensor_shape.h" namespace onnxruntime { struct PrePackedWeights final { // Some weights may be associated with multiple pre-packed buffers (e.g.) QLinearConv. // Hence we hold them in container. It is upto the developer implementing each PrePack() // method to define what gets stored in which position of the container. InlinedVector> buffers_; // cache pre-packed buffers associated with the kernel InlinedVector buffer_sizes_; // cache sizes of pre-packed buffers (in bytes) // Set when PrePack successfully produced kernel-owned packed weights that // intentionally cannot be stored in a shared pre-packed weights container. bool has_kernel_owned_packed_weights_{false}; // Produces a hash of the buffers stored in the given instance of this class HashValue GetHash() const; // The function creates a copy with non-owning BufferUniquePtrs. PrePackedWeights CreateReferringCopy() const; }; } // namespace onnxruntime