-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
220 lines (174 loc) · 7.08 KB
/
Copy pathCargo.toml
File metadata and controls
220 lines (174 loc) · 7.08 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
[package]
name = "volta"
description = "A PyTorch-like Machine Learning framework."
version = "0.3.0"
edition = "2024"
rust-version = "1.89.0"
build = "build.rs"
license = "MIT"
readme = "README.md"
repository = "https://github.com/rlarson20/Volta"
keywords = ["ml", "machine-learning", "autodiff", "tensor"]
categories = ["science"]
[dependencies]
bincode = { version = "2.0.1", features = ["derive"] }
approx = "0.5.1"
rand = "0.9.2"
rand_distr = "0.5.1"
matrixmultiply = "0.3.10"
# Dtype support
half = { version = "2.7.1", features = ["bytemuck"] }
bytemuck = { version = "1.24.0", features = ["derive"] }
# GPU support
wgpu = { version = "27.0.1", optional = true }
pollster = { version = "0.4.0", optional = true }
safetensors = "0.7.0"
thiserror = "2.0.18"
statrs = "0.18.0"
[[example]]
name = "gpu"
path = "examples/gpu.rs"
[[example]]
name = "showcase"
path = "examples/showcase.rs"
[[example]]
name = "readme1"
path = "examples/readme-1.rs"
[[example]]
name = "readme2"
path = "examples/readme-2.rs"
[[example]]
name = "load_external_mnist"
path = "examples/load_external_mnist.rs"
[[example]]
name = "mnist_cnn"
path = "examples/mnist_cnn.rs"
[[example]]
name = "mnist_rnn"
path = "examples/mnist_rnn.rs"
[[example]]
name = "regression"
path = "examples/regression.rs"
[[example]]
name = "char_language_model"
path = "examples/char_language_model.rs"
[[example]]
name = "char_transformer_model"
path = "examples/char_transformer_model.rs"
[[example]]
name = "dcgan"
path = "examples/dcgan.rs"
[[example]]
name = "gpu_training"
path = "examples/gpu_training.rs"
[[example]]
name = "super_resolution"
path = "examples/super_resolution.rs"
[[example]]
name = "time_sequence"
path = "examples/time_sequence.rs"
[[example]]
name = "vae"
path = "examples/vae.rs"
[target.'cfg(target_os = "macos")'.dependencies]
blas-src = { version = "0.14", features = ["accelerate"], optional = true }
[dev-dependencies]
criterion = "0.5"
[features]
default = ["gpu", "accelerate"]
accelerate = ["blas-src"]
gpu = ["wgpu", "pollster"]
[[bench]]
name = "tensor_ops"
harness = false
[[bench]]
name = "neural_networks"
harness = false
[[bench]]
name = "gpu_comparison"
harness = false
[[bench]]
name = "conv_algorithms"
harness = false
# =============================================================================
# Clippy Lints Configuration
# =============================================================================
# This configuration follows defensive programming principles from:
# https://corrode.dev/blog/defensive-programming/
#
# Organization:
# 1. Defensive/Safety Lints (deny) - Critical for correctness
# 2. Code Quality Lints (deny) - Important for maintainability
# 3. Pedantic Lints (selective) - Quality improvements where practical
# 4. Allowed Lints - Explicitly documented exceptions
# =============================================================================
[lints.clippy]
# -----------------------------------------------------------------------------
# 1. DEFENSIVE/SAFETY LINTS (deny)
# -----------------------------------------------------------------------------
# These lints prevent common sources of runtime errors and undefined behavior
# Memory safety and bounds checking
indexing_slicing = "deny" # Use .get() instead of [] to prevent panics
# Type safety and conversions
fallible_impl_from = "deny" # Fallible conversions should use TryFrom, not From
# Pattern matching safety
wildcard_enum_match_arm = "deny" # Force explicit handling of all enum variants
unneeded_field_pattern = "deny" # Don't ignore struct fields unnecessarily
# API design
fn_params_excessive_bools = "deny" # 4+ bool params usually indicate need for an enum
must_use_candidate = "deny" # Mark types that should not be ignored
# -----------------------------------------------------------------------------
# 2. CODE QUALITY LINTS (deny)
# -----------------------------------------------------------------------------
# These enforce consistent, readable, and maintainable code
# Code clarity
uninlined_format_args = "deny" # Use {var} instead of {}, var in format strings
redundant_else = "deny" # Remove unnecessary else after return
collapsible_if = "deny" # Simplify nested if statements
collapsible_else_if = "deny" # Simplify nested else-if chains
explicit_iter_loop = "deny" # Use iter() explicitly in for loops
semicolon_if_nothing_returned = "deny" # Consistent semicolon usage
# Type and trait improvements
default_trait_access = "deny" # Use Default::default() instead of Type::default()
implicit_clone = "deny" # Make clones explicit for clarity
assigning_clones = "deny" # Use clone_from when assigning clones
cast_lossless = "deny" # Use From/Into for lossless casts
# Pattern matching
single_match_else = "deny" # Use if-let for single match arms
match_same_arms = "deny" # Combine identical match arms
match_wildcard_for_single_variants = "deny" # Match specific variant instead of _
# Iterator and collection usage
map_unwrap_or = "deny" # Use map_or instead of map().unwrap_or()
map_clone = "deny" # Use copied()/cloned() instead of map(|x| x.clone())
map_flatten = "deny" # Use flat_map instead of map().flatten()
len_zero = "deny" # Use is_empty() instead of len() == 0
unnecessary_map_or = "deny" # Simplify unnecessary map_or usage
# Code organization
items_after_statements = "deny" # Keep items (fn, struct, etc.) before statements
enum_glob_use = "deny" # Avoid glob imports of enums
# Struct and field naming
struct_field_names = "deny" # Avoid redundant prefixes in struct field names
pub_underscore_fields = "deny" # Public fields shouldn't start with underscore
# Conditionals and control flow
bool_to_int_with_if = "deny" # Use as conversion instead of if bool { 1 } else { 0 }
if_not_else = "deny" # Put the positive case in if, not else
manual_let_else = "deny" # Use let-else syntax when appropriate
manual_assert = "deny" # Use assert! macro instead of manual if panic!
# Functions and returns
unnecessary_wraps = "deny" # Don't wrap return types unnecessarily
return_self_not_must_use = "deny" # Builder pattern methods should be #[must_use]
double_must_use = "deny" # Avoid duplicate #[must_use] attributes
# Documentation
doc_markdown = "deny" # Properly format doc comments
missing_panics_doc = "deny" # Document when functions can panic
missing_errors_doc = "deny" # Document error conditions
missing_fields_in_debug = "deny" # Include all fields in Debug implementations
# Misc improvements
unreadable_literal = "deny" # Use underscores in large numeric literals (1_000_000)
use_self = "deny" # Use Self instead of repeating type name
# -----------------------------------------------------------------------------
# 3. ALLOWED LINTS (with rationale)
# -----------------------------------------------------------------------------
# These are explicitly allowed because they don't fit this project's needs
# Pedantic lints that are too noisy or don't apply
similar_names = "allow" # Common in math/ML code (x, y, z, w, h, etc.)