1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===----------------------------------------------------------------------===//
// Copyright (c) 2026, Modular Inc. All rights reserved.
//
// Licensed under the Apache License v2.0 with LLVM Exceptions:
// https://llvm.org/LICENSE.txt
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
/// Creates a weights registry from parallel arrays of weight names and data
/// pointers.
///
/// The weights registry maps weight names to their backing data. It is used
/// with `M_initModel()` to provide weight data for models that use external
/// weights (via `constant_external` in the graph).
///
/// The data pointers are **borrowed, not copied**. You must keep the backing
/// memory alive for the lifetime of the weights registry.
///
/// @param names An array of null-terminated weight name strings.
/// @param data An array of pointers to weight data buffers. Each entry
/// corresponds to the weight name at the same index in `names`.
/// @param numWeights The number of entries in the `names` and `data` arrays.
/// @param status The status object for reporting errors.
///
/// @returns A pointer to the weights registry. You are responsible for the
/// memory associated with the pointer returned. The memory can be deallocated
/// by calling `M_freeWeightsRegistry()`. Returns `NULL` if creation fails,
/// with an error message in `status`.
MODULAR_API_EXPORT M_WeightsRegistry *;
/// Deallocates the memory for the weights registry. No-op if
/// `weightsRegistry` is `NULL`.
///
/// @param weightsRegistry The weights registry to deallocate.
MODULAR_API_EXPORT void
;
// MAX_C_WEIGHTS_H