MLX
 
Loading...
Searching...
No Matches
export.h
Go to the documentation of this file.
1// Copyright © 2024 Apple Inc.
2
3#pragma once
4
5#include <map>
6#include <set>
7#include "mlx/array.h"
8
9namespace mlx::core {
10
11using Args = std::vector<array>;
12using Kwargs = std::map<std::string, array>;
13
14struct FunctionExporter;
15
21 const std::string& file,
22 const std::function<std::vector<array>(const Args&)>& fun,
23 bool shapeless = false);
24
26 const std::string& file,
27 const std::function<std::vector<array>(const Kwargs&)>& fun,
28 bool shapeless = false);
29
31 const std::string& path,
32 const std::function<std::vector<array>(const Args&, const Kwargs&)>& fun,
33 bool shapeless = false);
34
39 const std::string& file,
40 const std::function<std::vector<array>(const Args&)>& fun,
41 const Args& args,
42 bool shapeless = false);
43
45 const std::string& file,
46 const std::function<std::vector<array>(const Kwargs&)>& fun,
47 const Kwargs& kwargs,
48 bool shapeless = false);
49
51 const std::string& file,
52 const std::function<std::vector<array>(const Args&, const Kwargs&)>& fun,
53 const Args& args,
54 const Kwargs& kwargs,
55 bool shapeless = false);
56
57struct ImportedFunction;
58
62ImportedFunction import_function(const std::string& file);
63
64} // namespace mlx::core
65
66#include "mlx/export_impl.h"
Definition allocator.h:7
FunctionExporter exporter(const std::string &file, const std::function< std::vector< array >(const Args &)> &fun, bool shapeless=false)
Make an exporter to save multiple traces of a given function to the same file.
void export_function(const std::string &file, const std::function< std::vector< array >(const Args &)> &fun, const Args &args, bool shapeless=false)
Export a function to a file.
ImportedFunction import_function(const std::string &file)
Import a function from a file.
std::vector< array > Args
Definition export.h:11
std::map< std::string, array > Kwargs
Definition export.h:12
Definition export_impl.h:11
Definition export_impl.h:54