-
Notifications
You must be signed in to change notification settings - Fork 1
/
mix.exs
147 lines (139 loc) · 4.45 KB
/
mix.exs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
defmodule ExTorch.MixProject do
use Mix.Project
def project do
[
app: :extorch,
version: "0.1.0-pre0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
test_coverage: [
ignore_modules: [
ExTorch.DType,
ExTorch.DelegateWithDocs,
ExTorch.DelegateWithDocs.Error,
ExTorch.Device,
ExTorch.Layout,
ExTorch.MemoryFormat,
ExTorch.ModuleMixin,
ExTorch.Native.BindingDeclaration,
ExTorch.Native.Macros,
ExTorch.Index.Slice,
ExTorch.Utils.ListWrapper,
Inspect.ExTorch.Tensor,
Mix.Tasks.PullLibTorch
]
],
description: description(),
package: package()
# compilers: [:rustler] ++ Mix.compilers(),
# rustler_crates: [extorch_native: []]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {ExTorch.Application, []},
extra_applications: [:logger, :ssl, :inets]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:rustler, "~> 0.29.0"},
{:ex_doc, "~> 0.23", only: :dev, runtime: false},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.3", only: [:dev], runtime: false}
# {:delegate_with_docs, "~> 0.1.0"}
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
defp description do
"Elixir/Erlang bindings for libtorch."
end
defp package do
[
# This option is only needed when you don't want to use the OTP application name
name: "extorch",
# These are the default files included in the package
files: ~w(lib priv native .formatter.exs mix.exs README* LICENSE*),
exclude_patterns: [
"native/extorch/target",
"native/extorch/.cargo",
"priv/native/libtorch",
"priv/native/libextorch.so",
"native/extorch/src/native/native.rs.sum"
],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/andfoy/extorch"}
]
end
defp docs do
[
main: "ExTorch",
# You can specify a function for adding
# custom content to the generated HTML.
# This is useful for custom JS/CSS files you want to include.
before_closing_body_tag: &before_closing_body_tag/1,
groups_for_functions: [
{:"Per-process settings", &(&1[:kind] == :process_values)},
{:"Tensor information", &(&1[:kind] == :tensor_info)},
{:"Tensor creation", &(&1[:kind] == :tensor_creation)},
{:"Tensor manipulation", &(&1[:kind] == :tensor_manipulation)},
{:"Tensor indexing", &(&1[:kind] == :tensor_indexing)},
{:"Pointwise math operations", &(&1[:kind] == :tensor_pointwise)},
{:"Reduction operations", &(&1[:kind] == :tensor_reduction)},
{:"Comparison operations", &(&1[:kind] == :tensor_comparison)},
{:"Other operations", &(&1[:kind] == :tensor_other_ops)}
],
groups_for_modules: [
"General API": [ExTorch, ExTorch.Tensor],
"Exchange types": [
ExTorch.Complex,
ExTorch.Index,
ExTorch.Index.Slice,
ExTorch.Tensor.Options,
ExTorch.Utils.PrintOptions,
ExTorch.Utils.ListWrapper
],
"Spec types": [
ExTorch.Scalar,
ExTorch.DType,
ExTorch.Device,
ExTorch.Layout,
ExTorch.MemoryFormat
],
Protocols: [ExTorch.Protocol.DefaultStruct],
Macros: [
ExTorch.Native.Macros,
ExTorch.Native.BindingDeclaration,
ExTorch.DelegateWithDocs,
ExTorch.ModuleMixin
],
"Native API": [ExTorch.Native],
"Other utilities": [ExTorch.Utils, ExTorch.Utils.Types]
]
# ...
]
end
# In our case we simply add a <script> tag
# that loads MathJax from CDN and specify the configuration.
# Once loaded, the script will dynamically turn any LaTeX
# expressions on the page into SVG images.
defp before_closing_body_tag(:html) do
"""
<script>
window.MathJax = {
tex: {
inlineMath: [['$', '$']],
displayMath: [['$$','$$']],
},
};
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
"""
end
defp before_closing_body_tag(_), do: ""
end