rusttorch 0.2.0

Eager PyTorch-style neural networks and graph execution for Rust, backed by LibTorch
Documentation
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
<!-- Generated by scripts/check-compatibility.py. Do not edit directly. -->
# API coverage

This page is generated from [`compat/pytorch_api.toml`](../compat/pytorch_api.toml) against PyTorch `v2.13.0` at commit `cf30153`, through `tch` `0.26.0`.
Each entry is independently scoped. Supported applies only to its written scope; row counts are not a compatibility score.

## Supported

### `core.device`

- **PyTorch:** `torch.device`, `torch.cuda.is_available`, `torch.backends.mps.is_available`
- **RustTorch:** `rusttorch_core::Device`, `rusttorch_core::DeviceSpec`, `rusttorch_core::DeviceCapabilities`, `rusttorch_core::available_devices`, `rusttorch_core::resolve_device`, `rusttorch::Device`, `rusttorch::DeviceSpec`, `rusttorch::DeviceCapabilities`, `rusttorch::available_devices`, `rusttorch::resolve_device`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** CPU resolution, runtime-reported CUDA and MPS capability mapping, explicit unavailable-device errors, and CUDA-then-MPS-then-CPU automatic selection.
- **Pinned source:** [`torch/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/__init__.py)
- **Evidence:** [`tests/device.rs::cpu_resolves_explicitly`](../tests/device.rs), [`tests/device.rs::reported_capabilities_match_resolved_devices`](../tests/device.rs), [`tests/device.rs::unavailable_or_out_of_range_cuda_is_an_error`](../tests/device.rs), [`tests/device.rs::explicit_mps_is_resolved_or_rejected_without_fallback`](../tests/device.rs)
- **Notes:** rusttorch-core owns the direct surface and the rusttorch facade preserves it. Accelerator branches are conditional on the linked runtime; this row does not claim a CUDA or MPS pass on every host.

### `data.batched_fetch`

- **PyTorch:** `torch.utils.data.Dataset.__getitems__`, `torch.utils.data._utils.fetch._MapDatasetFetcher`
- **RustTorch:** `rusttorch_data::Dataset::get_batch`, `rusttorch_data::Dataset::get_batch_with_context`, `rusttorch::data::Dataset::get_batch`, `rusttorch::data::Dataset::get_batch_with_context`
- **Implementation:** Implemented by RustTorch
- **Scope:** Source-compatible batched map-dataset fetch with an ordered per-index default, one Dataset::get\_batch call per DataLoader index batch, and an overridable context-aware hook for cooperative worker cancellation and deadlines; incorrect result cardinality is rejected before collation.
- **Pinned source:** [`torch/utils/data/_utils/fetch.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/_utils/fetch.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::loader_uses_one_batched_fetch_per_index_batch`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::loader_preserves_errors_from_a_short_dropped_tail`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::loader_rejects_wrong_batched_fetch_cardinality_before_collation`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/loader_builder.rs::wrong_batch_cardinality_is_typed_and_precedes_collation`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::early_drop_wakes_context_aware_fetch_and_joins`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::timeout_is_per_next_yielded_once_and_cancels_late_results`](../crates/rusttorch-data/tests/worker_lifecycle.rs)
- **Notes:** Rust map indices are usize and do not reproduce Python negative indexing. The preserved borrowed loader path treats wrong cardinality as a trait-contract violation, while the owned loader returns LoaderError::InvalidBatchCardinality; ordinary dataset and collation failures remain recoverable.

### `data.batches`

- **PyTorch:** `torch.utils.data.IterableDataset`, `torch.utils.data.DataLoader`
- **RustTorch:** `rusttorch_data::batches`, `rusttorch_data::batches_with_collate`, `rusttorch::data::batches`, `rusttorch::data::batches_with_collate`
- **Implementation:** Implemented by RustTorch
- **Scope:** Single-threaded batching of ordinary fallible Rust iterators, with explicit nonzero batch size, drop-last behavior, identity Vec collation or fallible custom collation, and one-error-then-exhaust semantics.
- **Pinned source:** [`torch/utils/data/_utils/fetch.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/_utils/fetch.py)
- **Evidence:** [`tests/data.rs::stream_batches_keep_a_short_tail`](../tests/data.rs), [`tests/data.rs::stream_batches_drop_a_short_tail`](../tests/data.rs), [`tests/data.rs::stream_batches_reject_zero_batch_size_with_a_structured_error`](../tests/data.rs), [`tests/data.rs::stream_batches_apply_fallible_collation`](../tests/data.rs), [`tests/data.rs::stream_batches_report_a_partial_drop_last_failure_once_then_exhaust`](../tests/data.rs), [`tests/data.rs::stream_batches_report_a_collation_failure_once_then_exhaust`](../tests/data.rs)
- **Notes:** rusttorch-data owns the direct surface and rusttorch::data preserves it. An ordinary Rust iterator is the streaming surface; RustTorch does not require an IterableDataset wrapper or claim Python multiprocessing behavior.

### `data.chain_dataset`

- **PyTorch:** `torch.utils.data.ChainDataset`
- **RustTorch:** `rusttorch_data::chain_datasets`, `rusttorch::data::chain_datasets`
- **Implementation:** Implemented by RustTorch
- **Scope:** Lazy sequential chaining for datasets or other Rust iterables through the standard IntoIterator flatten adapter, without custom buffering.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::chain_datasets_is_the_standard_flattened_iterator`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** RustTorch uses the standard typed iterator item in place of Python's dynamically typed dataset protocol.

### `data.concat_dataset`

- **PyTorch:** `torch.utils.data.ConcatDataset`
- **RustTorch:** `rusttorch_data::ConcatDataset`, `rusttorch::data::ConcatDataset`
- **Implementation:** Implemented by RustTorch
- **Scope:** Nonempty concatenation of same-typed map datasets with checked cumulative sizes and binary-search global index routing.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::concat_dataset_uses_global_indices_and_rejects_empty_input`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** Indices are usize, so Python negative-index translation is intentionally absent; all children share one Rust sample and error type.

### `data.dataset`

- **PyTorch:** `torch.utils.data.Dataset`
- **RustTorch:** `rusttorch_data::Dataset`, `rusttorch_data::DatasetSamples`, `rusttorch::data::Dataset`, `rusttorch::data::DatasetSamples`
- **Implementation:** Implemented by RustTorch
- **Scope:** Finite map-style datasets with owned samples, fallible indexed access, length and empty queries, and a lazy borrowing iterator over samples in index order.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`tests/data.rs::dataset_default_is_empty_follows_len`](../tests/data.rs), [`tests/data.rs::dataset_samples_borrow_and_fetch_lazily_in_order`](../tests/data.rs)
- **Notes:** rusttorch-data owns the direct surface and rusttorch::data preserves it. DatasetSamples performs no dataset clone or precollection; format-specific decoding belongs in optional packages.

### `data.loader`

- **PyTorch:** `torch.utils.data.DataLoader`
- **RustTorch:** `rusttorch_data::DataLoader`, `rusttorch_data::DataLoaderBuilder`, `rusttorch_data::OwnedDataLoader`, `rusttorch_data::LoaderIter`, `rusttorch_data::WorkerLoaderIter`, `rusttorch_data::SerialExecution`, `rusttorch_data::WorkerExecution`, `rusttorch_data::AutoBatch`, `rusttorch_data::ExplicitBatches`, `rusttorch_data::NoBatch`, `rusttorch_data::LoaderError`, `rusttorch_data::PipelineError`, `rusttorch::data::DataLoader`, `rusttorch::data::DataLoaderBuilder`, `rusttorch::data::OwnedDataLoader`, `rusttorch::data::LoaderIter`, `rusttorch::data::WorkerLoaderIter`, `rusttorch::data::SerialExecution`, `rusttorch::data::WorkerExecution`, `rusttorch::data::AutoBatch`, `rusttorch::data::ExplicitBatches`, `rusttorch::data::NoBatch`, `rusttorch::data::LoaderError`, `rusttorch::data::PipelineError`
- **Implementation:** Implemented by RustTorch
- **Scope:** Preserved borrowed single-pass loading plus owned, fresh epoch-aware serial or bounded map-worker iteration with default or explicit typed collation, optional no-batch conversion, sampler or batch-source plans, optional exact length, checked batch cardinality, typed five-stage one-error-then-exhaust failures, deterministic transforms, ordered or completion-order delivery, cooperative per-next timeout, optional loader-owned persistent worker pools, and order-independent PyTorch argument exclusions.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`tests/data.rs::loader_keeps_a_short_tail`](../tests/data.rs), [`tests/data.rs::loader_drops_a_short_tail`](../tests/data.rs), [`tests/data.rs::loader_rejects_zero_batch_size_with_a_structured_error`](../tests/data.rs), [`tests/data.rs::loader_applies_fallible_collation`](../tests/data.rs), [`tests/data.rs::loader_moves_non_clone_samples_into_batches`](../tests/data.rs), [`tests/data.rs::loader_discards_a_partial_batch_on_dataset_failure_then_exhausts`](../tests/data.rs), [`tests/data.rs::loader_yields_a_collation_failure_once_then_exhausts`](../tests/data.rs), [`tests/data.rs::facade_exposes_the_owned_loader_builder`](../tests/data.rs), [`tests/data.rs::facade_reexports_task_transform_and_worker_context_contracts`](../tests/data.rs), [`crates/rusttorch-data/tests/current_api.rs::owned_loader_generic_defaults_remain_source_compatible`](../crates/rusttorch-data/tests/current_api.rs), [`crates/rusttorch-data/tests/loader_builder.rs::defaults_batch_scalars_and_fresh_iterations_restart`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::batching_controls_custom_sources_and_collators`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::no_batching_uses_default_and_custom_conversion`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::optional_lengths_never_gate_iteration`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::set_epoch_forwards_through_every_plan`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::pipeline_failures_remain_typed_and_terminate_iteration`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::conflicts_are_order_independent`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::batch_sampler_conflicts_do_not_require_discarded_operational_bounds`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/loader_builder.rs::unallocatable_batch_size_is_a_typed_build_error_without_panicking`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/transform.rs::every_serial_stage_keeps_its_concrete_error_and_metadata`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::every_pipeline_variant_preserves_the_standard_error_source_chain`](../crates/rusttorch-data/tests/transform.rs)
- **Notes:** rusttorch-data owns the direct loader and rusttorch::data preserves it. Owned loading defaults to batch size one, sequential sampling, zero workers, ordered output, no pinning, no timeout, and no persistence. Positive map workers share an Arc dataset, fetch and transform on bounded deterministic Rust-thread lanes, and collate only on the coordinator. Rust threads replace Python multiprocessing\_context, subprocesses, and pickling. Rust cannot force-cancel non-cooperative dataset or native calls, so iterator and owner drop wait for those calls before joining. Explicit stream workers are tracked separately in data.stream\_workers; byte-budget, pinning, and exact serial checkpoint details are tracked in data.loader.prefetch, data.loader.pinning, and data.loader.checkpoint.

### `data.loader.checkpoint_stream`

- **PyTorch:** `No PyTorch symbol (RustTorch stream checkpoint extension)`
- **RustTorch:** `rusttorch_data::CheckpointableSource`, `rusttorch_data::CheckpointSourceFactory`, `rusttorch_data::StreamLoaderState`, `rusttorch_data::StreamLaneState`, `rusttorch_data::StreamCheckpointConfiguration`, `rusttorch_data::StreamCheckpointBuildError`, `rusttorch_data::StreamDataLoaderBuilder::checkpointable`, `rusttorch_data::StreamDataLoaderBuilder::resume`, `rusttorch_data::ExactStreamDataLoader`, `rusttorch_data::ExactStreamLoaderIter::checkpoint`, `rusttorch::data::StreamLoaderState`
- **Implementation:** Implemented by RustTorch
- **Scope:** RustTorch-native exact next-visible-batch replay for explicitly checkpointable sharded stream factories. Ordered shards emit strictly increasing global sequence IDs. A barrier cancels active reads, restores paired pre-attempt source/transform snapshots, drains unpublished records, and advances transport generation while retaining logical factory identity. Resume validates the envelope and all suspended source/transform/coordinator components before applying state. Original continuation, serde round trips, unequal/empty shards, global tail policy, terminal sources, and replay of advanced source/transform failures are covered.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/checkpoint_stream.rs::checkpoints_replay_every_boundary_and_original_continuation`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::resume_validation_is_atomic_and_static_rejection_precedes_callbacks`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::retained_source_gets_fresh_context_and_cancels_at_each_barrier_and_drop`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::active_transform_rolls_back_to_paired_pre_source_boundary`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::source_error_rolls_back_pre_attempt_and_preserves_error_chain`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::transform_failure_restores_paired_state_and_nonfused_end_replays`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::malformed_protocol_errors_once_and_ordinary_modes_stay_available`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::init_errors_and_panics_preserve_context_and_join`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::inline_snapshot_shapes_participate_in_aggregate_retention_limit`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::terminal_shards_do_not_hide_a_full_active_lane_with_a_gap`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::global_duplicate_and_state_configuration_drift_are_rejected`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::capacity_overflow_and_unsupported_settings_reject_before_workers`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::faster_later_failures_wait_for_lower_records_and_replay_in_order`](../crates/rusttorch-data/tests/checkpoint_stream.rs), [`crates/rusttorch-data/tests/checkpoint_stream.rs::source_failure_positions_obey_monotonic_and_bounded_gap_checks`](../crates/rusttorch-data/tests/checkpoint_stream.rs)
- **Notes:** This does not claim Python iterator-checkpoint parity. Exact streams require MemoryDisabled, NoWorkerInit, nonpersistent workers, and no timeout; ordinary stream defaults and generic auto-traits remain unchanged. Sources retaining context must implement set\_run\_context. Bounded journals retain at most prefetch\_factor + batch\_size + 1 entries per lane under the checked 64 MiB aggregate allocation ceiling; nested user-state heap contents are not a total-RSS bound. No samples are serialized or discarded records collated/pinned. Blocking callbacks remain cooperatively cancellable and drop joins. Persistence format and policy belong to the application.

### `data.random_split`

- **PyTorch:** `torch.utils.data.random_split`
- **RustTorch:** `rusttorch_data::SplitLength`, `rusttorch_data::random_split`, `rusttorch::data::SplitLength`, `rusttorch::data::random_split`
- **Implementation:** Implemented by RustTorch
- **Scope:** Seeded non-overlapping splits from exact usize counts or finite fractions summing to one, with fractional floors and round-robin remainder distribution.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::random_split_requires_integer_lengths_to_sum_to_dataset_length`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::random_split_floors_fractions_and_distributes_remainder_round_robin`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::random_split_rejects_fraction_floors_larger_than_the_dataset`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::random_split_is_deterministic_and_allows_zero_length_parts`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** SplitLength is a typed Rust enum replacing Python's mixed numeric list, and produced subset indices are usize; the seeded ChaCha12 permutation is reproducible within RustTorch rather than claimed PyTorch RNG identity.

### `data.sampler`

- **PyTorch:** `torch.utils.data.Sampler`, `torch.utils.data.BatchSampler`, `torch.utils.data.SequentialSampler`, `torch.utils.data.RandomSampler`, `torch.utils.data.SubsetRandomSampler`, `torch.utils.data.WeightedRandomSampler`
- **RustTorch:** `rusttorch_data::Sampler`, `rusttorch_data::BatchSource`, `rusttorch_data::FnSampler`, `rusttorch_data::FnBatchSource`, `rusttorch_data::BatchSampler`, `rusttorch_data::SequentialSampler`, `rusttorch_data::RandomSampler`, `rusttorch_data::SubsetRandomSampler`, `rusttorch_data::WeightedRandomSampler`, `rusttorch::data::Sampler`, `rusttorch::data::BatchSource`, `rusttorch::data::FnSampler`, `rusttorch::data::FnBatchSource`, `rusttorch::data::BatchSampler`, `rusttorch::data::SequentialSampler`, `rusttorch::data::RandomSampler`, `rusttorch::data::SubsetRandomSampler`, `rusttorch::data::WeightedRandomSampler`
- **Implementation:** Implemented by RustTorch
- **Scope:** Fresh finite epoch-aware index and index-batch iterator contracts with optional exact lengths; direct fixed-size batching with explicit tail policy; direct sequential, seeded replacement and repeated-permutation random, subset, and weighted sampling; and sized or unsized closure factories. Caller-controlled storage dimensions fail with typed configuration errors rather than capacity-overflow panics. Weighted sampling validates positive sample count, nonempty finite nonnegative weights, positive finite total weight, replacement cardinality, and unique numerically stable positive-first selection with deterministic zero-weight fill without replacement.
- **Pinned source:** [`torch/utils/data/sampler.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/sampler.py)
- **Evidence:** [`tests/data.rs::sequential_sampler_yields_every_index_in_order`](../tests/data.rs), [`tests/data.rs::random_sampler_is_seeded_and_yields_a_permutation`](../tests/data.rs), [`tests/data_libtorch.rs::random_sampler_does_not_change_libtorch_global_rng`](../tests/data_libtorch.rs), [`crates/rusttorch-data/tests/samplers.rs::random_sampler_preserves_the_empty_length_error_contract`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::random_sampler_with_replacement_is_seeded_and_bounded`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::random_sampler_without_replacement_repeats_complete_permutations`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::random_sampler_rejects_unrepresentable_storage_without_panicking`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::subset_random_sampler_yields_one_seeded_permutation`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::weighted_random_sampler_validates_inputs`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::weighted_random_sampler_with_replacement_is_deterministic_and_has_cardinality`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::weighted_random_sampler_rejects_unrepresentable_storage_without_panicking`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::weighted_random_sampler_without_replacement_is_unique_and_fills_zero_weights`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::weighted_random_sampler_keeps_equal_subnormal_weights_random`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::concrete_samplers_create_fresh_epoch_aware_iterators`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::subset_and_weighted_samplers_create_fresh_epoch_iterators`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::fn_sampler_factories_are_fresh_and_length_is_optional`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/samplers.rs::fn_batch_source_factories_are_fresh_and_length_is_optional`](../crates/rusttorch-data/tests/samplers.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::batch_sampler_keeps_or_drops_the_exact_tail`](../crates/rusttorch-data/tests/batch_sampler.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::batch_sampler_accepts_a_one_shot_custom_iterator`](../crates/rusttorch-data/tests/batch_sampler.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::batch_sampler_validates_public_storage_dimensions_without_panicking`](../crates/rusttorch-data/tests/batch_sampler.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::batch_sampler_recreates_sized_sampler_iterations_and_forwards_epoch`](../crates/rusttorch-data/tests/batch_sampler.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::batch_sampler_preserves_an_unsized_sampler_source`](../crates/rusttorch-data/tests/batch_sampler.rs), [`crates/rusttorch-data/tests/batch_sampler.rs::fn_batch_source_recreates_nonuniform_batches_for_each_epoch`](../crates/rusttorch-data/tests/batch_sampler.rs)
- **Notes:** rusttorch-data owns the direct samplers and rusttorch::data preserves them. Concrete samplers and BatchSampler over an iterator remain ordinary one-shot Iterator values for source compatibility, while Sampler and BatchSource create fresh iterators for owned-loader epochs. Randomness uses sampler-local ChaCha12 state and never LibTorch's global RNG; deterministic RustTorch seeds do not provide exact PyTorch Philox sequence parity.

### `data.sampler.distributed`

- **PyTorch:** `torch.utils.data.DistributedSampler`
- **RustTorch:** `rusttorch_data::DistributedSampler`, `rusttorch::data::DistributedSampler`
- **Implementation:** Implemented by RustTorch
- **Scope:** Explicit replica/rank sharding over finite usize index ranges, with equal per-rank lengths, cyclic padding or global-tail truncation, deterministic epoch-aware optional shuffling, fresh reusable iterations, and direct-iterator position reporting. Empty datasets yield no indices on every valid rank, and invalid or unrepresentable dimensions return typed configuration errors.
- **Pinned source:** [`torch/utils/data/distributed.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/distributed.py)
- **Evidence:** [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_cyclically_pads_equal_rank_lengths`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_truncates_to_disjoint_rank_strides`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_validates_replica_and_rank_configuration`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_rejects_unrepresentable_padding_and_storage_without_panicking`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_is_deterministic_per_epoch_and_creates_fresh_iterations`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_tracks_direct_iteration_position_and_resets_on_epoch`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_accepts_empty_datasets_for_every_valid_rank`](../crates/rusttorch-data/tests/distributed_sampler.rs), [`crates/rusttorch-data/tests/distributed_sampler.rs::distributed_sampler_does_not_change_libtorch_global_rng`](../crates/rusttorch-data/tests/distributed_sampler.rs)
- **Notes:** RustTorch requires explicit replica and rank values instead of consulting a process group. Shuffle uses sampler-local ChaCha12 state and never LibTorch's global RNG; deterministic RustTorch seeds do not claim exact PyTorch Philox sequence parity. Versioned distributed sampler configuration and active cursor state are proven for exact serial and ordered prefetched worker checkpoints in data.loader.checkpoint.

### `data.stack_dataset`

- **PyTorch:** `torch.utils.data.StackDataset`
- **RustTorch:** `rusttorch_data::StackDataset`, `rusttorch_data::StackTuple`, `rusttorch::data::StackDataset`, `rusttorch::data::StackTuple`
- **Implementation:** Implemented by RustTorch
- **Scope:** Equal-length typed dataset tuples at arities two through eight, producing aligned sample tuples whose children share one error type.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::stack_dataset_checks_lengths_and_returns_tuples`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::stack_dataset_supports_tuple_arities_two_through_eight`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** Typed Rust tuples replace Python's positional tuple or string-keyed dictionary StackDataset forms; indices are usize and dictionary stacking is represented by an application-defined typed struct instead of dynamic keys.

### `data.subset`

- **PyTorch:** `torch.utils.data.Subset`
- **RustTorch:** `rusttorch_data::Subset`, `rusttorch::data::Subset`
- **Implementation:** Implemented by RustTorch
- **Scope:** Validated selection of usize source indices with shared ownership available through blanket Dataset delegation for Arc&lt;D&gt;.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::subset_validates_source_indices_and_arc_delegates_dataset`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** Construction rejects out-of-range usize indices, so Python negative indexing is intentionally not reproduced.

### `data.tensor_dataset`

- **PyTorch:** `torch.utils.data.TensorDataset`
- **RustTorch:** `rusttorch_data::TensorDataset`, `rusttorch::data::TensorDataset`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Nonempty tensors with equal first dimensions and ordered Vec&lt;Tensor&gt; row samples whose ordinary indexed views share LibTorch storage with the source tensors.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** [`crates/rusttorch-data/tests/datasets.rs::tensor_dataset_returns_one_row_from_each_tensor`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::tensor_dataset_rejects_mismatched_first_dimensions`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::tensor_dataset_get_returns_storage_sharing_views`](../crates/rusttorch-data/tests/datasets.rs), [`crates/rusttorch-data/tests/datasets.rs::tensor_dataset_get_batch_returns_storage_sharing_views`](../crates/rusttorch-data/tests/datasets.rs)
- **Notes:** A typed Vec&lt;Tensor&gt; replaces Python's dynamically sized tuple, indices are usize, and storage-sharing mutation means this adapter is not automatically replay-safe.

### `graph.executor`

- **PyTorch:** `torch.fx.Interpreter`
- **RustTorch:** `rusttorch::graph::EagerExecutor`, `rusttorch::graph::GraphModule`, `rusttorch::graph::GraphInputs`, `rusttorch::graph::GraphOutputs`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Fallible eager execution of RustTorch typed graphs with named inputs and outputs, mode tracking, autograd, and runtime tensor-spec validation.
- **Pinned source:** [`torch/fx/interpreter.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fx/interpreter.py)
- **Evidence:** [`tests/graph.rs::all_public_graph_operations_execute_with_expected_values`](../tests/graph.rs), [`tests/graph.rs::residual_branch_accumulates_input_and_all_linear_parameter_gradients`](../tests/graph.rs), [`tests/graph.rs::runtime_rejects_dtype_rank_and_known_dimension_mismatches`](../tests/graph.rs), [`tests/graph.rs::dropout_follows_train_and_eval_mode_without_rng_assumptions`](../tests/graph.rs)
- **Notes:** Execution delegates kernels to LibTorch and does not consume Python FX graphs.

### `graph.inspection`

- **PyTorch:** `torch.fx.Graph.print_tabular`, `torch.fx.Graph.__str__`
- **RustTorch:** `rusttorch::graph::Graph::summary`, `rusttorch::graph::Graph::to_dot`, `rusttorch::graph::GraphModule::summary`, `rusttorch::graph::GraphModule::to_dot`
- **Implementation:** Implemented by RustTorch
- **Scope:** Deterministic textual summaries and DOT output for RustTorch graphs.
- **Pinned source:** [`torch/fx/graph.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fx/graph.py)
- **Evidence:** [`tests/graph.rs::summary_and_dot_are_deterministic_and_describe_the_graph`](../tests/graph.rs)
- **Notes:** DOT generation returns text and does not invoke Graphviz.

### `graph.ops`

- **PyTorch:** `ATen identity, linear, relu, gelu, dropout, flatten, add, sub, mul, cat, mse_loss, and cross_entropy operations`
- **RustTorch:** `rusttorch::graph::GraphOp`, `rusttorch::graph::GraphBuilder`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Exactly the enumerated graph operations, eager execution, current validation, and tested shape-propagation rules.
- **Pinned source:** [`torch/nn/functional.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/functional.py)
- **Evidence:** [`tests/graph.rs::all_public_graph_operations_execute_with_expected_values`](../tests/graph.rs), [`tests/graph.rs::binary_shape_propagation_preserves_dimension_order`](../tests/graph.rs)
- **Notes:** Arbitrary ATen dispatch and unlisted operators are not included.

### `graph.passes`

- **PyTorch:** `torch.fx.passes`
- **RustTorch:** `rusttorch::graph::GraphPass`, `rusttorch::graph::Validation`, `rusttorch::graph::DeadNodeElimination`, `rusttorch::graph::ShapePropagation`, `rusttorch::graph::PassReport`
- **Implementation:** Implemented by RustTorch
- **Scope:** Validation, dead-node deactivation, and the tested shape-propagation subset for RustTorch graphs.
- **Pinned source:** [`torch/fx/passes/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fx/passes/__init__.py)
- **Evidence:** [`tests/graph.rs::finish_eliminates_dead_nodes_and_propagates_flatten_linear_shapes`](../tests/graph.rs)
- **Notes:** These passes operate on RustTorch graphs and do not accept arbitrary FX passes.

### `nn.cross_entropy`

- **PyTorch:** `torch.nn.functional.cross_entropy`
- **RustTorch:** `rusttorch::nn::functional::cross_entropy`
- **Implementation:** Delegated to LibTorch
- **Scope:** Default class-index cross entropy with deterministic values on the tested shape.
- **Pinned source:** [`torch/nn/functional.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/functional.py)
- **Evidence:** [`tests/eager.rs::mse_and_cross_entropy_have_deterministic_values`](../tests/eager.rs)
- **Notes:** Weights, custom ignore index, label smoothing, probability targets, and reduction selection are not exposed.

### `nn.flatten`

- **PyTorch:** `torch.nn.Flatten`, `torch.flatten`
- **RustTorch:** `rusttorch::nn::Flatten`, `rusttorch::nn::functional::flatten`
- **Implementation:** Delegated to LibTorch
- **Scope:** Dimension-range flattening with Rust integer dimensions for the tested default and graph negative-end ranges.
- **Pinned source:** [`torch/nn/modules/flatten.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/flatten.py)
- **Evidence:** [`tests/eager.rs::identity_relu_gelu_and_flatten_match_expected_behavior`](../tests/eager.rs), [`tests/graph.rs::finish_eliminates_dead_nodes_and_propagates_flatten_linear_shapes`](../tests/graph.rs)
- **Notes:** Python dynamic argument coercion is not supported.

### `nn.identity`

- **PyTorch:** `torch.nn.Identity`
- **RustTorch:** `rusttorch::nn::Identity`
- **Implementation:** Delegated to LibTorch
- **Scope:** Identity forward behavior on the tested eager tensor and graph path.
- **Pinned source:** [`torch/nn/modules/linear.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/linear.py)
- **Evidence:** [`tests/eager.rs::identity_relu_gelu_and_flatten_match_expected_behavior`](../tests/eager.rs), [`tests/graph.rs::all_public_graph_operations_execute_with_expected_values`](../tests/graph.rs)
- **Notes:** The Rust unit type does not accept arbitrary ignored Python arguments.

### `nn.linear`

- **PyTorch:** `torch.nn.Linear`, `torch.nn.functional.linear`
- **RustTorch:** `rusttorch::nn::Linear`, `rusttorch::nn::LinearConfig`, `rusttorch::nn::linear`, `rusttorch::nn::functional::linear`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Biased and bias-free forward behavior, parameter shapes and names, gradients, deterministic values, and the tested short constructor.
- **Pinned source:** [`torch/nn/modules/linear.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/linear.py)
- **Evidence:** [`tests/eager.rs::linear_bias_and_no_bias_have_expected_shapes_and_values`](../tests/eager.rs), [`tests/eager.rs::gradients_flow_through_linear`](../tests/eager.rs), [`tests/eager.rs::short_linear_constructor_uses_bias`](../tests/eager.rs)
- **Notes:** Rust configuration replaces Python keyword arguments; kernels delegate to LibTorch.

### `nn.mse_loss`

- **PyTorch:** `torch.nn.functional.mse_loss`
- **RustTorch:** `rusttorch::nn::functional::mse_loss`
- **Implementation:** Delegated to LibTorch
- **Scope:** Mean-reduced mean-squared error with a deterministic value on the tested shape.
- **Pinned source:** [`torch/nn/functional.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/functional.py)
- **Evidence:** [`tests/eager.rs::mse_and_cross_entropy_have_deterministic_values`](../tests/eager.rs)
- **Notes:** Alternative reductions and the wider PyTorch broadcasting surface are not exposed.

### `nn.relu`

- **PyTorch:** `torch.nn.ReLU`, `torch.nn.functional.relu`
- **RustTorch:** `rusttorch::nn::ReLU`, `rusttorch::nn::functional::relu`
- **Implementation:** Delegated to LibTorch
- **Scope:** Out-of-place ReLU values on the tested eager and graph paths, including gradients in a composed residual graph.
- **Pinned source:** [`torch/nn/modules/activation.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/activation.py)
- **Evidence:** [`tests/eager.rs::identity_relu_gelu_and_flatten_match_expected_behavior`](../tests/eager.rs), [`tests/graph.rs::residual_branch_accumulates_input_and_all_linear_parameter_gradients`](../tests/graph.rs)
- **Notes:** In-place mutation is not exposed.

### `runtime.setup`

- **PyTorch:** `PyTorch binary backend selection`
- **RustTorch:** `rusttorch setup --backend auto`, `rusttorch setup --backend cpu`, `rusttorch setup --backend cuda-12.6`
- **Implementation:** Implemented by RustTorch
- **Scope:** Project-local LibTorch selection for automatic, CPU or MPS, and CUDA 12.6 distributions with conflict and driver validation.
- **Pinned source:** [`torch/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/__init__.py)
- **Evidence:** [`crates/rusttorch-cli/src/main.rs::backend_parser_accepts_only_the_approved_names`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::preconfiguration_detects_every_supported_environment_variable`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::driver_parser_uses_the_first_output_line`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::auto_reuses_preconfiguration_and_selects_supported_acceleration`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::explicit_backend_refuses_active_preconfiguration`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::explicit_cuda_requires_a_supported_platform_and_driver`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::auto_falls_back_to_cpu_for_incompatible_drivers`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::configuration_preserves_unrelated_toml_and_writes_cuda_selection`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::configuration_switches_owned_cuda_selection_to_cpu`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::managed_setup_rejects_target_overrides_before_configuration_write`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_selectors_preserve_auto_and_reject_explicit_before_probe_or_write`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_selectors_cover_ancestors_home_legacy_and_every_runtime_variable`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_selectors_merge_tables_and_obey_process_force_precedence`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_owned_cuda_can_switch_but_cannot_hide_ancestor_runtime`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_unresolved_config_fails_closed_without_writes`](../crates/rusttorch-cli/src/main.rs), [`crates/rusttorch-cli/src/main.rs::cargo_build_script_confirms_effective_selector_resolution`](../crates/rusttorch-cli/src/main.rs)
- **Notes:** Setup resolves process and applicable workspace/ancestor/CARGO\_HOME selectors with Cargo legacy-file and env-table precedence before backend selection; managed CUDA ownership permits switching. Unresolvable includes, mixed entry types, and inactive user-owned CUDA entries fail closed. Setup invokes Cargo and the upstream downloader; it never installs or modifies system drivers.

## Partial

### `autograd.reverse_mode`

- **PyTorch:** `torch.Tensor.backward`, `torch.no_grad`, `torch.Tensor.detach`
- **RustTorch:** `rusttorch_core::Tensor`, `rusttorch_core::no_grad`, `rusttorch_core::no_grad_guard`, `rusttorch::Tensor`, `rusttorch::no_grad`, `rusttorch::no_grad_guard`
- **Implementation:** Delegated to LibTorch
- **Scope:** Reverse-mode gradients through the tested eager and graph operations, plus tested no-grad and detach behavior.
- **Pinned source:** [`torch/autograd/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/autograd/__init__.py)
- **Evidence:** [`tests/eager.rs::gradients_accumulate_across_eager_residual_branches`](../tests/eager.rs), [`tests/eager.rs::no_grad_and_detach_stop_gradient_recording`](../tests/eager.rs)
- **Notes:** rusttorch-core owns these direct reexports and the rusttorch facade preserves them; LibTorch owns autograd, while hooks, custom Function, forward AD, and the rest of the Python surface remain outside this claim.

### `core.random`

- **PyTorch:** `torch.manual_seed`
- **RustTorch:** `rusttorch_core::manual_seed`, `rusttorch::manual_seed`
- **Implementation:** Delegated to LibTorch
- **Scope:** A seed can be delegated to LibTorch; deterministic behavior and cross-language stream identity are not yet verified by a focused test.
- **Pinned source:** [`torch/random.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/random.py)
- **Evidence:** —
- **Notes:** rusttorch-core owns the direct function and the rusttorch facade preserves it. The function remains partial until executable evidence proves its documented contract.

### `core.tensor`

- **PyTorch:** `torch.Tensor`, `torch.dtype`, `torch.nn.functional reduction`
- **RustTorch:** `rusttorch_core::Tensor`, `rusttorch_core::Kind`, `rusttorch_core::Reduction`, `rusttorch::Tensor`, `rusttorch::Kind`, `rusttorch::Reduction`
- **Implementation:** Delegated to LibTorch
- **Scope:** Root type reexports plus the tensor construction, dtype, device, and eager operations exercised by current RustTorch tests.
- **Pinned source:** [`torch/_tensor.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/_tensor.py)
- **Evidence:** [`tests/eager.rs::tensor_core_types_are_reexported`](../tests/eager.rs)
- **Notes:** rusttorch-core owns the direct reexports and the rusttorch facade preserves them. Reexporting tch::Tensor is not evidence that every torch.Tensor method matches PyTorch.

### `data.collation`

- **PyTorch:** `torch.utils.data.default_collate`, `torch.utils.data.default_convert`, `torch.utils.data._utils.collate.collate`
- **RustTorch:** `rusttorch_data::Collate`, `rusttorch_data::VecCollate`, `rusttorch_data::FnCollate`, `rusttorch_data::DefaultCollator`, `rusttorch_data::DefaultCollate`, `rusttorch_data::DefaultConverter`, `rusttorch_data::DefaultConvert`, `rusttorch_data::Bytes`, `rusttorch_data::CollateError`, `rusttorch::data::Collate`, `rusttorch::data::VecCollate`, `rusttorch::data::FnCollate`, `rusttorch::data::DefaultCollator`, `rusttorch::data::DefaultCollate`, `rusttorch::data::DefaultConverter`, `rusttorch::data::DefaultConvert`, `rusttorch::data::Bytes`, `rusttorch::data::CollateError`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Typed Rust collation stacks tensors on dimension zero, creates exact-kind tensors from supported Rust scalars, preserves strings and Bytes records, and recursively collates uniform options, equal-length vectors, tuples of arity two through eight, and BTreeMap values with identical keys. Typed no-batching conversion preserves leaves and recursively converts those containers without vector transposition. VecCollate and fallible FnCollate provide explicit escape hatches.
- **Pinned source:** [`torch/utils/data/_utils/collate.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/_utils/collate.py)
- **Evidence:** [`crates/rusttorch-data/tests/collate.rs::tensors_stack_on_a_new_leading_dimension`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::numeric_scalars_use_their_exact_libtorch_kinds`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::strings_and_bytes_remain_records`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::tuples_collate_each_field_through_arity_eight`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::equal_vectors_transpose_before_recursive_collation`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::mismatched_vector_lengths_are_typed_errors`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::options_require_uniform_presence_and_recurse`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::maps_require_identical_keys_and_recurse_over_values`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::empty_batches_and_incompatible_tensors_return_errors`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::default_converter_preserves_leaves_and_recurses_without_transposing`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::default_converter_collate_requires_exactly_one_sample`](../crates/rusttorch-data/tests/collate.rs), [`crates/rusttorch-data/tests/collate.rs::custom_and_vector_collators_are_explicit_escape_hatches`](../crates/rusttorch-data/tests/collate.rs), [`tests/data.rs::facade_reexports_typed_collation_contracts`](../tests/data.rs)
- **Notes:** RustTorch uses associated Rust types and a Bytes newtype instead of Python's runtime type registry. It does not support NumPy arrays/scalars, Python mappings/sequences/namedtuples, mutable registry extension, dynamic coercion between unrelated Rust types, or every Python scalar type. Tensor construction and stacking delegate fallibly to LibTorch; structural mismatches and checked allocation boundaries return non-exhaustive CollateError variants.

### `data.dataset.datapipes`

- **PyTorch:** `torch.utils.data.DataChunk`, `torch.utils.data.DFIterDataPipe`, `torch.utils.data.IterDataPipe`, `torch.utils.data.MapDataPipe`
- **RustTorch:** `std::iter::Iterator`, `rusttorch_data::Dataset`, `rusttorch_data::WorkerSourceFactory`, `rusttorch_data::Transform`, `rusttorch::data::Dataset`, `rusttorch::data::WorkerSourceFactory`, `rusttorch::data::Transform`
- **Implementation:** Implemented by RustTorch
- **Scope:** Ordinary typed Rust iterators replace basic iterable DataPipe traversal, Dataset replaces indexed MapDataPipe access, WorkerSourceFactory creates independent sharded iterators, and Transform composes typed sample operations.
- **Pinned source:** [`torch/utils/data/datapipes/datapipe.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/datapipes/datapipe.py)
- **Evidence:** [`crates/rusttorch-data/tests/stream_workers.rs::four_explicit_modulo_shards_produce_each_logical_record_once`](../crates/rusttorch-data/tests/stream_workers.rs), [`tests/data.rs::dataset_samples_borrow_and_fetch_lazily_in_order`](../tests/data.rs)
- **Notes:** RustTorch does not reproduce functional-name registration, reset/single-iterator hooks, Python serialization hooks, dataframe tracing, or DFIterDataPipe. Vec is the closest DataChunk container but does not retain a separate original-items raw iterator, so DataChunk is not claimed as supported.

### `data.loader.checkpoint`

- **PyTorch:** `No PyTorch symbol (RustTorch checkpoint extension)`
- **RustTorch:** `rusttorch_data::LOADER_STATE_SCHEMA_VERSION`, `rusttorch_data::LoaderState`, `rusttorch_data::LoaderConfiguration`, `rusttorch_data::CheckpointPinRequest`, `rusttorch_data::CheckpointPinStatus`, `rusttorch_data::CheckpointBuildError`, `rusttorch_data::Checkpointable`, `rusttorch_data::ReplaySafeDataset`, `rusttorch_data::DatasetCheckpoint`, `rusttorch_data::Stateless`, `rusttorch_data::TransactionalCheckpoint`, `rusttorch_data::WorkerCheckpoint`, `rusttorch_data::ReplaySafeMap`, `rusttorch_data::TransactionalMap`, `rusttorch_data::ReplaySafeTensorDataset`, `rusttorch_data::StatelessWorker`, `rusttorch_data::TransactionalWorker`, `rusttorch_data::DataLoaderBuilder::dataset_identity`, `rusttorch_data::DataLoaderBuilder::resume_from`, `rusttorch_data::DataLoaderBuilder::checkpoint_stateless`, `rusttorch_data::DataLoaderBuilder::checkpoint_transactional`, `rusttorch_data::LoaderIter::checkpoint`, `rusttorch_data::WorkerLoaderIter::checkpoint`, `rusttorch_data::WorkerTransformState`, `rusttorch_data::WorkerTransformLanes`, `rusttorch_data::WorkerLaneState`, `rusttorch_data::SequentialSamplerState`, `rusttorch_data::RandomSamplerState`, `rusttorch_data::SubsetRandomSamplerState`, `rusttorch_data::WeightedRandomSamplerState`, `rusttorch_data::DistributedSamplerState`, `rusttorch_data::BatchSamplerState`, `rusttorch::data::LoaderState`, `rusttorch::data::CheckpointBuildError`, `rusttorch::data::ReplaySafeMap`, `rusttorch::data::TransactionalMap`, `rusttorch::data::ReplaySafeTensorDataset`
- **Implementation:** Implemented by RustTorch
- **Scope:** Versioned serde state and exact next-visible-batch resume for serial map loaders and ordered prefetched map workers. Serial replay supports explicit replay-safe or transactional datasets. Positive workers require ReplaySafeMap (or a copy-safe tensor wrapper satisfying native Send/Sync), MemoryDisabled, NoWorkerInit, nonpersistent workers, and no timeout. Every built-in checkpointable sampler, automatic/explicit/no batching, transactional or explicitly stateless transforms, coordinator state, and pin identity are supported. Worker barriers cancel and account dispatched tasks, restore bounded per-lane pre-task snapshots, discard unpublished samples, rewind the sampler, and replay in deterministic lanes. Resume validates the envelope and all components before any apply and retains suspended worker instances.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_every_boundary_continues_and_resumes`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_transactional_lanes_and_zero_workers_restore_every_boundary`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_delayed_low_lane_keeps_earliest_unconsumed_snapshot`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_hidden_transform_failure_replays_after_lower_batches`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_fetch_and_cardinality_errors_recur_at_hidden_batch`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_sampler_and_stateless_task_rng_replay`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_explicit_and_no_batch_plans_restore`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_validation_is_transactional_and_threads_join`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_capability_drift_and_factory_sources_are_explicit`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::prefetched_factory_identity_survives_transport_generation_changes`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::json_round_trip_resumes_every_serial_boundary_exactly`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::short_tail_drop_last_and_invalid_boundaries_are_explicit`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::every_concrete_sampler_and_epoch_restores_its_active_cursor`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::explicit_batch_sampler_and_no_batch_converter_resume`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::stateful_transform_and_coordinator_restore_after_last_visible_batch`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::deterministic_transform_failure_recurs_at_the_same_logical_batch`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::transactional_dataset_restores_serial_fetch_state`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::resume_validates_every_component_before_any_apply`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::envelope_and_configuration_drift_reject_before_iteration`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::replay_safe_tensor_dataset_owns_backing_and_each_fetched_row`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::no_batch_state_targets_the_effective_converter`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::resume_build_error_preserves_configuration_and_factory_sources`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::pin_request_and_effective_status_are_checkpoint_identity`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::sampler_and_distributed_semantic_corruption_rejects_without_panicking`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`crates/rusttorch-data/tests/checkpoint_map.rs::malformed_json_is_a_storage_error_not_a_loader_fallback`](../crates/rusttorch-data/tests/checkpoint_map.rs), [`tests/data.rs::facade_reexports_exact_serial_checkpoint_contracts`](../tests/data.rs)
- **Notes:** This is a RustTorch-native replay capability, not Python iterator-checkpoint parity. Serial schema v1 remains unchanged; worker transform state carries a separate versioned lane/configuration and factory/transport-generation envelope. Each map lane retains at most prefetch\_factor + 1 snapshots. Typed checkpoint queues/rings and coordinator ledgers participate in the checked 64 MiB allocation preflight; arbitrary state heap contents are item-bounded, not a total-RSS guarantee. Blocking callbacks remain cooperatively cancellable and drop joins. Transactional datasets remain serial-only. Persistent/initialized/byte-enabled/timeout worker replay remains unsupported. Exact sharded streams are tracked in data.loader.checkpoint\_stream. Storage format and persistence policy are caller-owned.

### `data.loader.pinning`

- **PyTorch:** `torch.utils.data.DataLoader(pin_memory=...)`
- **RustTorch:** `rusttorch_data::PinMemory`, `rusttorch_data::PinMemoryStatus`, `rusttorch_data::PinDisabled`, `rusttorch_data::PinEnabled`, `rusttorch_data::Auto`, `rusttorch_data::Explicit`, `rusttorch_data::DataLoaderBuilder::pin_memory`, `rusttorch_data::DataLoaderBuilder::pin_memory_for`, `rusttorch_data::OwnedDataLoader::pin_memory_enabled`, `rusttorch_data::OwnedDataLoader::pin_memory_status`, `rusttorch_data::StreamDataLoaderBuilder::pin_memory`, `rusttorch_data::StreamDataLoaderBuilder::pin_memory_for`, `rusttorch_data::StreamDataLoader::pin_memory_enabled`, `rusttorch_data::StreamDataLoader::pin_memory_status`, `rusttorch::data::PinMemory`, `rusttorch::data::PinMemoryStatus`, `rusttorch::data::DataLoaderBuilder::pin_memory`, `rusttorch::data::DataLoaderBuilder::pin_memory_for`, `rusttorch::data::OwnedDataLoader::pin_memory_status`, `rusttorch::data::StreamDataLoaderBuilder::pin_memory`, `rusttorch::data::StreamDataLoaderBuilder::pin_memory_for`, `rusttorch::data::StreamDataLoader::pin_memory_status`
- **Implementation:** Implemented by RustTorch
- **Scope:** Type-state-enabled recursive post-collation pinning for map and explicitly sharded stream loaders across Tensor, Vec, Option, tuples of arity two through eight, and BTreeMap values, with identity scalar/string/Bytes leaves, exact batch types, typed source-preserving failures, automatic CUDA-device-zero selection, and explicit available-CUDA validation before callbacks.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/pin_memory.rs::recursive_pin_memory_preserves_identity_leaves_keys_and_shape_without_clone`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::tensor_and_nested_cuda_pinning_is_checked_when_cuda_exists`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::automatic_pin_status_is_effective_and_preserves_the_exact_batch_type`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::disabled_custom_batch_has_no_pin_memory_bound`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::explicit_unsupported_devices_reject_before_factory_callbacks`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::pinning_runs_after_collation_in_both_setter_orders_when_cuda_exists`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::pin_failure_is_typed_once_when_cuda_exists`](../crates/rusttorch-data/tests/pin_memory.rs), [`crates/rusttorch-data/tests/pin_memory.rs::stream_auto_pin_status_and_batch_type_are_preserved`](../crates/rusttorch-data/tests/pin_memory.rs), [`tests/data.rs::facade_reexports_memory_and_pinning_contracts`](../tests/data.rs)
- **Notes:** Automatic pinning uses CUDA device zero because RustTorch has no current-CUDA-index API. CPU-only and MPS-only runtimes report DisabledNoAccelerator and perform a no-op; explicit CPU, MPS, Vulkan, other devices, and unavailable CUDA indices are rejected. CUDA storage assertions and forced pin-failure evidence are conditional on the linked runtime exposing CUDA. Deprecated Python pin\_memory\_device is not reproduced; pin\_memory\_for(Device) is the typed replacement. This does not claim PyTorch custom pin\_memory duck typing, accelerator selection beyond CUDA, or asynchronous transfer benchmarks.

### `data.loader.prefetch`

- **PyTorch:** `torch.utils.data.DataLoader(prefetch_factor=...)`
- **RustTorch:** `rusttorch_data::MemoryFootprint`, `rusttorch_data::MemoryDisabled`, `rusttorch_data::MemoryEnabled`, `rusttorch_data::DataLoaderBuilder::prefetch_factor`, `rusttorch_data::DataLoaderBuilder::prefetch_bytes`, `rusttorch_data::OwnedDataLoader::effective_prefetch_factor`, `rusttorch_data::OwnedDataLoader::effective_prefetch_bytes`, `rusttorch_data::StreamDataLoaderBuilder::prefetch_factor`, `rusttorch_data::StreamDataLoaderBuilder::prefetch_bytes`, `rusttorch_data::StreamDataLoader::effective_prefetch_factor`, `rusttorch_data::StreamDataLoader::effective_prefetch_bytes`, `rusttorch::data::MemoryFootprint`, `rusttorch::data::DataLoaderBuilder::prefetch_factor`, `rusttorch::data::DataLoaderBuilder::prefetch_bytes`, `rusttorch::data::OwnedDataLoader::effective_prefetch_bytes`, `rusttorch::data::StreamDataLoaderBuilder::prefetch_bytes`, `rusttorch::data::StreamDataLoader::effective_prefetch_bytes`
- **Implementation:** Implemented by RustTorch
- **Scope:** Positive map workers use checked bounded task/control/result storage and a global item-credit limit of workers multiplied by prefetch\_factor. Optional nonzero prefetch\_bytes adds a strict generation-scoped post-transform logical-payload budget to map batches and stream records through result queues and ordered reassembly, with cancellation-safe RAII permits, exact oversize metadata, sequence-aware ordered admission, bounded stream front waiters, and one-error-then-exhaust behavior.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/loader_builder.rs::scalar_configuration_is_validated_and_prefetch_is_normalized`](../crates/rusttorch-data/tests/loader_builder.rs), [`crates/rusttorch-data/tests/map_workers.rs::global_outstanding_work_uses_default_and_explicit_checked_credits`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::build_rejects_before_sampler_or_batch_source_epoch_callbacks`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/memory_budget.rs::footprints_are_recursive_capacity_aware_and_saturating`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::byte_accounting_uses_the_final_transform_type_in_either_setter_order`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::disabled_custom_types_remain_item_bounded_without_new_trait_bounds`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::map_zero_workers_reject_byte_prefetch_before_iteration_callbacks`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::oversized_transformed_map_batch_has_exact_metadata_once`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::ordered_map_byte_admission_blocks_high_until_delayed_low_is_consumable`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::unordered_unsequenced_oversize_preserves_exact_stream_metadata_once`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::ordered_oversize_preserves_stream_identity_without_guessing_a_batch`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::ordered_byte_stream_rejects_missing_and_nonmonotonic_same_shard_sequences`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::ordered_byte_admission_allows_delayed_low_progress_and_persistent_reuse`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::early_drop_cancels_a_blocked_permit_and_persistent_restart_has_no_leak`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/memory_budget.rs::timeout_cancels_ordered_budget_waiters_before_persistent_restart`](../crates/rusttorch-data/tests/memory_budget.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::full_result_queue_and_idle_task_waits_wake_on_drop`](../crates/rusttorch-data/tests/worker_lifecycle.rs)
- **Notes:** MemoryFootprint is an infallible saturating logical-payload estimate, not whole-process RSS: tensor views/shared backing storage and allocator/node overhead are outside the contract. The coordinator releases permits when moving values into its one active item-bounded collation batch, which is deliberately outside prefetch\_bytes. Byte accounting is opt-in and requires the final post-transform type; disabled custom types retain the item-only contract.

### `data.loader.transforms`

- **PyTorch:** `torch.utils.data.Dataset transform conventions`, `torch.utils.data.DataLoader(generator=...)`
- **RustTorch:** `rusttorch_data::TaskContext`, `rusttorch_data::CancellationToken`, `rusttorch_data::Deadline`, `rusttorch_data::WaitOutcome`, `rusttorch_data::LoaderCancelled`, `rusttorch_data::Transform`, `rusttorch_data::FnTransform`, `rusttorch_data::TransformFactory`, `rusttorch_data::FnTransformFactory`, `rusttorch_data::IdentityTransformFactory`, `rusttorch_data::DataLoaderBuilder::transform`, `rusttorch_data::DataLoaderBuilder::transform_factory`, `rusttorch_data::DataLoaderBuilder::seed`, `rusttorch_data::DataLoaderBuilder::epoch`, `rusttorch_data::DataLoaderBuilder::rank`, `rusttorch_data::TASK_RNG_DERIVATION_VERSION`, `rusttorch::data::TaskContext`, `rusttorch::data::CancellationToken`, `rusttorch::data::Deadline`, `rusttorch::data::WaitOutcome`, `rusttorch::data::LoaderCancelled`, `rusttorch::data::Transform`, `rusttorch::data::FnTransform`, `rusttorch::data::TransformFactory`, `rusttorch::data::FnTransformFactory`, `rusttorch::data::IdentityTransformFactory`, `rusttorch::data::DataLoaderBuilder::transform`, `rusttorch::data::DataLoaderBuilder::transform_factory`, `rusttorch::data::DataLoaderBuilder::seed`, `rusttorch::data::DataLoaderBuilder::epoch`, `rusttorch::data::DataLoaderBuilder::rank`, `rusttorch::data::TASK_RNG_DERIVATION_VERSION`
- **Implementation:** Implemented by RustTorch
- **Scope:** Owned loading constructs one typed transform per serial iterator or per worker, reuses it for that lifecycle, supplies monotonic logical occurrence IDs plus cooperative cancellation and deadline state, and preserves dataset, transform, collation, transform-construction, and worker-initialization error types through PipelineError. Version-1 task seeds deterministically mix loader seed, epoch, rank, logical sample, and stage into task-local ChaCha12 state without worker assignment.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/transform.rs::task_rng_is_versioned_schedule_independent_and_has_a_locked_seed`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::task_rng_does_not_change_libtorch_global_rng`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::fn_transform_preserves_output_and_error_types`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::serial_factory_creates_one_transform_per_iterator_and_context_ids_restart`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::transform_builder_clones_fresh_state_for_each_iterator`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::every_serial_stage_keeps_its_concrete_error_and_metadata`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/transform.rs::pipeline_error_generic_positions_are_distinct`](../crates/rusttorch-data/tests/transform.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::context_aware_transform_wakes_on_drop_and_deadline`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`tests/data.rs::facade_reexports_task_transform_and_worker_context_contracts`](../tests/data.rs)
- **Notes:** The fixed SplitMix64-style mixer and ChaCha12 sequence are versioned RustTorch contracts; they do not reproduce PyTorch generator or Philox sequences. Deterministic modulo lanes give stateful worker transforms a reproducible history.

### `data.loader.workers`

- **PyTorch:** `torch.utils.data.DataLoader(num_workers=...)`, `torch.utils.data.get_worker_info`
- **RustTorch:** `rusttorch_data::DataLoaderBuilder::workers`, `rusttorch_data::DataLoaderBuilder::persistent_workers`, `rusttorch_data::DataLoaderBuilder::timeout`, `rusttorch_data::DataLoaderBuilder::worker_init`, `rusttorch_data::OwnedDataLoader::workers`, `rusttorch_data::WorkerInfo`, `rusttorch_data::WorkerContext`, `rusttorch_data::CancellationToken`, `rusttorch_data::Deadline`, `rusttorch_data::WaitOutcome`, `rusttorch_data::LoaderCancelled`, `rusttorch_data::WorkerInit`, `rusttorch_data::FnWorkerInit`, `rusttorch_data::NoWorkerInit`, `rusttorch_data::get_worker_info`, `rusttorch_data::WORKER_SEED_DERIVATION_VERSION`, `rusttorch::data::DataLoaderBuilder::workers`, `rusttorch::data::DataLoaderBuilder::persistent_workers`, `rusttorch::data::DataLoaderBuilder::timeout`, `rusttorch::data::DataLoaderBuilder::worker_init`, `rusttorch::data::OwnedDataLoader::workers`, `rusttorch::data::WorkerInfo`, `rusttorch::data::WorkerContext`, `rusttorch::data::CancellationToken`, `rusttorch::data::Deadline`, `rusttorch::data::WaitOutcome`, `rusttorch::data::LoaderCancelled`, `rusttorch::data::WorkerInit`, `rusttorch::data::FnWorkerInit`, `rusttorch::data::NoWorkerInit`, `rusttorch::data::get_worker_info`, `rusttorch::data::WORKER_SEED_DERIVATION_VERSION`
- **Implementation:** Implemented by RustTorch
- **Scope:** Positive map-worker counts create joinable bounded Rust threads sharing an Arc dataset, route batch sequence s to worker s modulo worker count, initialize and construct one transform per worker, fetch and transform with cooperative generation cancellation and per-next deadlines, collate on the coordinator, preserve sampler order by default, optionally yield completion order, convert worker panics, and terminate after one typed failure. Optional persistent pools reuse threads, initial seeds, initializer calls, and factory-created transforms while quiescing and discarding tagged stale work between fresh generations.
- **Pinned source:** [`torch/utils/data/_utils/worker.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/_utils/worker.py)
- **Evidence:** [`crates/rusttorch-data/tests/map_workers.rs::positive_workers_fetch_batches_concurrently_on_distinct_threads`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::ordered_and_completion_modes_follow_the_selected_contract`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::batch_sequence_routes_to_its_modulo_worker_across_iterations`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::factory_and_initializer_run_once_per_worker_with_fresh_generations`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::worker_and_coordinator_errors_are_typed_visible_once_and_contextual`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::worker_panics_are_converted_with_worker_and_batch_context`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::early_drop_disconnects_saturated_work_and_joins_every_worker`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/map_workers.rs::overflowing_timeout_rejects_before_plan_or_worker_callbacks`](../crates/rusttorch-data/tests/map_workers.rs), [`crates/rusttorch-data/tests/worker_context.rs::worker_info_scopes_are_nested_and_panic_safe`](../crates/rusttorch-data/tests/worker_context.rs), [`crates/rusttorch-data/tests/worker_context.rs::worker_info_is_isolated_between_concurrent_threads`](../crates/rusttorch-data/tests/worker_context.rs), [`crates/rusttorch-data/tests/worker_context.rs::worker_info_validates_identity_and_locks_versioned_seed_derivation`](../crates/rusttorch-data/tests/worker_context.rs), [`crates/rusttorch-data/tests/worker_context.rs::worker_seed_derivation_does_not_change_libtorch_global_rng`](../crates/rusttorch-data/tests/worker_context.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::public_cancellation_and_deadline_waits_are_notification_driven`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::timeout_deadline_is_fresh_for_each_blocking_next`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::unordered_ready_batch_does_not_block_on_saturated_lane_refill`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::first_error_cancels_siblings_and_every_worker_exits_once`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::worker_init_error_and_panic_are_visible_once`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::full_result_queue_and_idle_task_waits_wake_on_drop`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::nonpersistent_iterations_use_fresh_consecutive_seed_ranges`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::serial_factory_gets_none_and_worker_callbacks_get_lifecycle_context`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::persistent_workers_reuse_threads_seeds_and_callbacks_across_epochs`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::persistent_early_drop_discards_stale_sequence_zero_in_ordered_and_unordered_modes`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`crates/rusttorch-data/tests/worker_lifecycle.rs::non_cooperative_fetch_makes_drop_wait_until_explicit_release`](../crates/rusttorch-data/tests/worker_lifecycle.rs), [`tests/data.rs::facade_reexports_task_transform_and_worker_context_contracts`](../tests/data.rs)
- **Notes:** Rust threads replace Python subprocesses: map datasets are shared rather than copied, collation stays on the coordinator, and WorkerInfo intentionally omits an erased dataset. Worker and task seeds are versioned local derivations with no PyTorch generator or Philox identity. Persistent factory and initializer contexts use the pool-lifetime shutdown token; fetch and task contexts use a fresh generation token and dynamic deadline. The compiling WorkerContext rustdoc demonstrates both cancellation and deadline outcomes. Nonzero loader timeouts must fit the platform monotonic clock; public overflowing deadlines fail closed as expired. Rust cannot force-cancel a non-cooperative dataset or native call, so drop waits until it returns before joining. Optional post-collation recursive pinning is tracked separately in data.loader.pinning.

### `data.stream_workers`

- **PyTorch:** `torch.utils.data.IterableDataset`, `torch.utils.data.DataLoader(num_workers=...)`, `torch.utils.data.DataLoader(in_order=...)`, `torch.utils.data.DataLoader(persistent_workers=...)`
- **RustTorch:** `rusttorch_data::SequenceId`, `rusttorch_data::LogicalSampleId`, `rusttorch_data::WorkerRecord`, `rusttorch_data::WorkerSourceFactory`, `rusttorch_data::StreamDataLoaderBuilder`, `rusttorch_data::StreamDataLoader`, `rusttorch_data::StreamLoaderIter`, `rusttorch::data::SequenceId`, `rusttorch::data::LogicalSampleId`, `rusttorch::data::WorkerRecord`, `rusttorch::data::WorkerSourceFactory`, `rusttorch::data::StreamDataLoaderBuilder`, `rusttorch::data::StreamDataLoader`, `rusttorch::data::StreamLoaderIter`
- **Implementation:** Implemented by RustTorch
- **Scope:** Explicitly sharded positive-worker Rust streams with one owned iterator per worker and generation, stable logical sample identity, optional exact global length, ordered contiguous global sequence reassembly or completion-order delivery, coordinator-side global batching and collation, checked bounded result/preallocated-flat-reassembly/batch allocation, typed pipeline/protocol/panic failures, ready-completion-first cooperative per-next timeout and cancellation, and optional loader-owned persistent worker pools.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** [`crates/rusttorch-data/tests/stream_workers.rs::four_explicit_modulo_shards_produce_each_logical_record_once`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::ordered_sequence_protocol_rejects_every_gap_and_duplicate_shape_once`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::ordered_full_credit_window_reports_first_gap_instead_of_timing_out`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::ordered_internal_gap_beyond_same_worker_quota_is_protocol_error`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::unordered_records_may_be_unsequenced_and_task_rng_uses_logical_id`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::coordinator_batches_globally_and_drops_only_one_global_tail`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::per_worker_credits_bound_fast_shards_without_blocking_their_progress`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::every_stream_stage_failure_is_typed_contextual_and_visible_once`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::queued_low_record_beats_an_expired_deadline_after_high_reassembly`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::queued_protocol_error_beats_expiry_after_a_high_record`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/src/stream.rs::queued_error_and_end_beat_an_expired_receive_deadline`](../crates/rusttorch-data/src/stream.rs), [`crates/rusttorch-data/tests/stream_workers.rs::cooperative_stream_source_wakes_on_timeout_and_early_drop`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::drop_waits_for_a_noncooperative_source_instead_of_detaching_it`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::full_result_queue_drop_wakes_and_joins_every_worker`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::persistent_ordered_and_unordered_workers_recreate_sources_but_keep_pool_state`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::persistent_early_drop_drains_stale_results_before_both_delivery_modes_restart`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::persistent_exhaustion_waits_until_the_generation_source_is_dropped`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::persistent_source_destructor_panic_is_visible_and_poisons_the_pool`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::first_protocol_failure_cancels_before_releasing_reassembly_credits`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::iterator_drop_cancels_before_releasing_reassembly_credits`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::invalid_stream_builders_fail_before_factory_or_worker_side_effects`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::large_inline_batch_and_reassembly_storage_are_rejected_before_callbacks`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::sparse_one_entry_reassembly_uses_one_concrete_vec_slot`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/stream_workers.rs::oversized_one_entry_vec_aggregate_is_rejected_before_every_callback`](../crates/rusttorch-data/tests/stream_workers.rs), [`crates/rusttorch-data/tests/current_api.rs::stream_loader_remains_sync_for_send_but_not_sync_output`](../crates/rusttorch-data/tests/current_api.rs), [`tests/data.rs::facade_exposes_explicit_stream_worker_contracts`](../tests/data.rs)
- **Notes:** RustTorch uses threads and typed explicitly sharded factories rather than Python worker processes or a shared IterableDataset object. Ordered sources must provide a unique zero-based contiguous global sequence; unordered sources may omit sequence but must provide stable logical IDs. Byte-enabled ordered shards additionally emit strictly increasing IDs per shard; bounded front-waiter state detects a globally missing ID without byte deadlock. Ordered reassembly is one loader-owned preallocated flat vector with linear lookup in the bounded credit window; its actual retained capacity is validated before callbacks and reused across generations. RustTorch merges before batching, so drop\_last removes at most one global tail instead of PyTorch iterable-style per-process tails. Cancellation is cooperative and drop joins rather than force-cancelling a blocking native source. Checkpoint/resume remains outside this row.

### `graph.ir`

- **PyTorch:** `torch.fx.Graph`, `torch.fx.Node`
- **RustTorch:** `rusttorch::graph::Graph`, `rusttorch::graph::GraphBuilder`, `rusttorch::graph::Node`, `rusttorch::graph::NodeId`, `rusttorch::graph::ValueId`, `rusttorch::graph::TensorSpec`
- **Implementation:** Implemented by RustTorch
- **Scope:** The tested construction, validation, branching, named-value, topological-order, reachability, and tensor-spec behavior of RustTorch's typed DAG.
- **Pinned source:** [`torch/fx/graph.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fx/graph.py)
- **Evidence:** [`tests/graph.rs::builder_rejects_a_value_from_another_graph`](../tests/graph.rs), [`tests/graph.rs::builder_rejects_duplicate_node_names`](../tests/graph.rs), [`tests/graph.rs::graph_without_an_output_is_rejected`](../tests/graph.rs)
- **Notes:** This is neither FX serialization nor full FX node and transformation parity.

### `nn.dropout`

- **PyTorch:** `torch.nn.Dropout`, `torch.nn.functional.dropout`
- **RustTorch:** `rusttorch::nn::Dropout`, `rusttorch::nn::functional::dropout`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Validated probabilities, explicit functional mode, module train/eval behavior, boundary probabilities, and evaluation gradients.
- **Pinned source:** [`torch/nn/modules/dropout.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/dropout.py)
- **Evidence:** [`tests/eager.rs::dropout_boundary_probabilities_and_eval_gradients_are_correct`](../tests/eager.rs)
- **Notes:** The full stochastic distribution, all shapes and dtypes, and backend parity are not claimed.

### `nn.gelu`

- **PyTorch:** `torch.nn.GELU`, `torch.nn.functional.gelu`
- **RustTorch:** `rusttorch::nn::Gelu`, `rusttorch::nn::GeluApproximation`, `rusttorch::nn::functional::gelu`, `rusttorch::nn::functional::gelu_with_approximation`
- **Implementation:** Delegated to LibTorch
- **Scope:** Exact GELU forward values for the tested default approximation.
- **Pinned source:** [`torch/nn/modules/activation.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/activation.py)
- **Evidence:** [`tests/eager.rs::identity_relu_gelu_and_flatten_match_expected_behavior`](../tests/eager.rs)
- **Notes:** GeluApproximation::Tanh is exposed but lacks focused numerical and gradient evidence.

### `nn.module`

- **PyTorch:** `torch.nn.Module`
- **RustTorch:** `rusttorch::nn::Module`
- **Implementation:** Implemented by RustTorch
- **Scope:** Send-safe fallible forward and forward\_t dispatch, with tested train/eval state on Sequential and GraphModule.
- **Pinned source:** [`torch/nn/modules/module.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/module.py)
- **Evidence:** [`tests/eager.rs::sequential_uses_numeric_parameter_names_and_tracks_mode`](../tests/eager.rs), [`tests/graph.rs::dropout_follows_train_and_eval_mode_without_rng_assumptions`](../tests/graph.rs)
- **Notes:** Python attributes, hooks, buffers, traversal, mutation, and class reconstruction are not present.

### `nn.sequential`

- **PyTorch:** `torch.nn.Sequential`
- **RustTorch:** `rusttorch::nn::Sequential`, `rusttorch::nn::SequentialBuilder`
- **Implementation:** Implemented by RustTorch
- **Scope:** Ordered construction from current layer specs, numeric parameter names, eager forward, mode tracking, device movement, and SafeTensors methods.
- **Pinned source:** [`torch/nn/modules/container.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/container.py)
- **Evidence:** [`tests/eager.rs::sequential_uses_numeric_parameter_names_and_tracks_mode`](../tests/eager.rs), [`tests/backend_parity.rs::accelerator_safetensors_and_cpu_movement_preserve_model_state`](../tests/backend_parity.rs)
- **Notes:** Accelerator branches skip when unavailable; arbitrary dynamic module insertion is not supported.

### `optim.adam`

- **PyTorch:** `torch.optim.Adam`
- **RustTorch:** `rusttorch::optim::Adam`, `rusttorch::optim::Optimizer`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** The exposed validated builder options plus zero\_grad, step, and backward\_step, including one deterministic update.
- **Pinned source:** [`torch/optim/adam.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/optim/adam.py)
- **Evidence:** [`tests/eager.rs::sgd_and_adam_each_update_a_parameter_once`](../tests/eager.rs), [`tests/eager.rs::invalid_layer_dropout_and_optimizer_configs_are_rejected`](../tests/eager.rs), [`tests/python_parity.rs::bidirectional_python_parity`](../tests/python_parity.rs)
- **Notes:** The Python parity test is ignored by ordinary Cargo test and runs only through scripts/run-python-parity.sh; optimizer checkpoints and unexposed options remain unsupported.

### `optim.sgd`

- **PyTorch:** `torch.optim.SGD`
- **RustTorch:** `rusttorch::optim::Sgd`, `rusttorch::optim::Optimizer`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** The exposed validated builder options plus zero\_grad, step, and backward\_step, including one deterministic update.
- **Pinned source:** [`torch/optim/sgd.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/optim/sgd.py)
- **Evidence:** [`tests/eager.rs::sgd_and_adam_each_update_a_parameter_once`](../tests/eager.rs), [`tests/eager.rs::invalid_layer_dropout_and_optimizer_configs_are_rejected`](../tests/eager.rs), [`tests/python_parity.rs::bidirectional_python_parity`](../tests/python_parity.rs)
- **Notes:** The Python parity test is ignored by ordinary Cargo test and runs only through scripts/run-python-parity.sh; optimizer checkpoints and unexposed options remain unsupported.

### `serialization.mapping`

- **PyTorch:** `torch.nn.Module.load_state_dict key adaptation`
- **RustTorch:** `rusttorch::interop::StateDictMapping`, `rusttorch::interop::load_state_dict_with_mapping`
- **Implementation:** Implemented by RustTorch
- **Scope:** Explicit exact-key mapping and tested dry-run validation without fuzzy matching or implicit tensor transforms.
- **Pinned source:** [`torch/nn/modules/module.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/module.py)
- **Evidence:** [`tests/interop.rs::exact_mapping_loads_the_named_destination`](../tests/interop.rs), [`tests/interop.rs::dry_run_reports_a_load_without_mutating_values`](../tests/interop.rs)
- **Notes:** Prefix mapping is exposed but does not yet have focused executable evidence.

### `serialization.safetensors`

- **PyTorch:** `safetensors.torch.save_file`, `safetensors.torch.load_file`
- **RustTorch:** `rusttorch::interop::save_state_dict`, `rusttorch::interop::load_state_dict`, `rusttorch::nn::Sequential::save_weights`, `rusttorch::nn::Sequential::load_weights`, `rusttorch::graph::GraphModule::save_weights`, `rusttorch::graph::GraphModule::load_weights`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Tested CPU SafeTensors state round trips plus manually gated Python-to-Rust and Rust-to-Python exchange with architecture supplied separately.
- **Pinned source:** [`torch/nn/modules/module.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/module.py)
- **Evidence:** [`tests/interop.rs::strict_safetensors_round_trip_restores_all_variables`](../tests/interop.rs), [`tests/python_parity.rs::bidirectional_python_parity`](../tests/python_parity.rs)
- **Notes:** The Python evidence requires scripts/run-python-parity.sh and is ignored by ordinary Cargo test; state loads to the target device.

### `serialization.state_dict`

- **PyTorch:** `torch.nn.Module.state_dict`, `torch.nn.Module.load_state_dict`
- **RustTorch:** `rusttorch::interop::save_state_dict`, `rusttorch::interop::load_state_dict`, `rusttorch::interop::LoadOptions`, `rusttorch::interop::LoadReport`
- **Implementation:** RustTorch frontend backed by LibTorch
- **Scope:** Strict and non-strict SafeTensors loads with sorted reports and tested pre-mutation shape validation.
- **Pinned source:** [`torch/nn/modules/module.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/module.py)
- **Evidence:** [`tests/interop.rs::non_strict_load_returns_a_sorted_complete_report`](../tests/interop.rs), [`tests/interop.rs::shape_validation_happens_before_any_variable_is_mutated`](../tests/interop.rs)
- **Notes:** Optimizer state, arbitrary buffers, aliases, Python objects, and non-SafeTensors formats are not covered.

## Planned

### `amp`

- **PyTorch:** `torch.amp.autocast`, `torch.amp.GradScaler`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Automatic mixed precision, gradient scaling, and dtype policy are not exposed yet.
- **Pinned source:** [`torch/amp/autocast_mode.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/amp/autocast_mode.py)
- **Evidence:** —
- **Notes:** A future surface must state supported devices and dtypes and carry backend parity evidence.

### `audio`

- **PyTorch:** `torch.utils.data.Dataset for audio samples`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Audio decoding, resampling, feature extraction, and augmentation belong in an optional data package.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Decoded typed samples will use the shared RustTorch data-loading core.

### `autograd.forward_ad`

- **PyTorch:** `torch.autograd.forward_ad`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Forward-mode automatic differentiation and dual tensors are not exposed.
- **Pinned source:** [`torch/autograd/forward_ad.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/autograd/forward_ad.py)
- **Evidence:** —
- **Notes:** This row is separate from the currently tested reverse-mode subset.

### `codec`

- **PyTorch:** `torch.utils.data.Dataset for encoded media`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** General image, audio, and video codec integration is not included in the core crate.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Optional format packages will turn encoded records into typed loader samples.

### `compiler.export.interop`

- **PyTorch:** `torch.export.save`, `torch.export.load`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** PT2 ExportedProgram archive import, validation, execution, and export are not implemented.
- **Pinned source:** [`torch/export/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/export/__init__.py)
- **Evidence:** —
- **Notes:** Artifact support must pin the archive version and supported operator set.

### `distributed.c10d`

- **PyTorch:** `torch.distributed.init_process_group`, `torch.distributed.ProcessGroup`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Collectives, process groups, rendezvous, and distributed error handling are not exposed.
- **Pinned source:** [`torch/distributed/distributed_c10d.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/distributed/distributed_c10d.py)
- **Evidence:** —
- **Notes:** Future support must enumerate transports, operating systems, and failure semantics.

### `distributed.ddp`

- **PyTorch:** `torch.nn.parallel.DistributedDataParallel`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Distributed data parallel training, bucket scheduling, and state synchronization are not implemented.
- **Pinned source:** [`torch/nn/parallel/distributed.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/parallel/distributed.py)
- **Evidence:** —
- **Notes:** This depends on an independently verified process-group foundation.

### `distributed.fsdp`

- **PyTorch:** `torch.distributed.fsdp.FullyShardedDataParallel`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Parameter sharding, resharding, mixed precision, and distributed checkpoint integration are not implemented.
- **Pinned source:** [`torch/distributed/fsdp/fully_sharded_data_parallel.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/distributed/fsdp/fully_sharded_data_parallel.py)
- **Evidence:** —
- **Notes:** FSDP follows process groups, distributed checkpointing, and memory benchmarks.

### `distributions`

- **PyTorch:** `torch.distributions.Distribution`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Probability distributions, transforms, constraints, sampling, and log-probability APIs are not exposed.
- **Pinned source:** [`torch/distributions/distribution.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/distributions/distribution.py)
- **Evidence:** —
- **Notes:** Each future distribution requires numerical and gradient parity evidence.

### `fft`

- **PyTorch:** `torch.fft`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** The torch.fft namespace is not wrapped or compatibility-tested.
- **Pinned source:** [`torch/fft/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fft/__init__.py)
- **Evidence:** —
- **Notes:** Future coverage will be split by transform family and normalization behavior.

### `func`

- **PyTorch:** `torch.func`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Function transforms such as vmap, grad, jacrev, jacfwd, and functionalization are not exposed.
- **Pinned source:** [`torch/_functorch/apis.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/_functorch/apis.py)
- **Evidence:** —
- **Notes:** Rust interfaces require explicit ownership and mutation semantics.

### `linalg`

- **PyTorch:** `torch.linalg`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** The torch.linalg namespace is not wrapped or compatibility-tested.
- **Pinned source:** [`torch/linalg/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/linalg/__init__.py)
- **Evidence:** —
- **Notes:** Future rows will split decompositions, solvers, norms, and matrix functions.

### `nested`

- **PyTorch:** `torch.nested`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Nested tensor construction, operators, autograd, and layout behavior are not exposed.
- **Pinned source:** [`torch/nested/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nested/__init__.py)
- **Evidence:** —
- **Notes:** Support depends on stable LibTorch bindings and backend evidence.

### `nn.attention`

- **PyTorch:** `torch.nn.MultiheadAttention`, `torch.nn.functional.scaled_dot_product_attention`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Multi-head and scaled-dot-product attention modules, masks, kernels, and fast paths are not exposed.
- **Pinned source:** [`torch/nn/modules/activation.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/activation.py)
- **Evidence:** —
- **Notes:** Backend and dtype-dependent kernels require separate compatibility evidence.

### `nn.convolution`

- **PyTorch:** `torch.nn.Conv1d`, `torch.nn.Conv2d`, `torch.nn.Conv3d`, `torch.nn.functional.conv2d`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Convolution modules and functional variants are not exposed through RustTorch.
- **Pinned source:** [`torch/nn/modules/conv.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/conv.py)
- **Evidence:** —
- **Notes:** Future coverage will name dimensions, padding, groups, dtypes, and backends.

### `nn.normalization`

- **PyTorch:** `torch.nn.BatchNorm1d`, `torch.nn.LayerNorm`, `torch.nn.GroupNorm`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Normalization modules, functional forms, running statistics, and distributed variants are not exposed.
- **Pinned source:** [`torch/nn/modules/batchnorm.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/batchnorm.py)
- **Evidence:** —
- **Notes:** Future rows will separate batch, layer, group, and instance normalization.

### `nn.recurrent`

- **PyTorch:** `torch.nn.RNN`, `torch.nn.LSTM`, `torch.nn.GRU`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Recurrent modules, packed sequences, state layouts, and projections are not exposed.
- **Pinned source:** [`torch/nn/modules/rnn.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/rnn.py)
- **Evidence:** —
- **Notes:** Each family needs batch-first, direction, layer, dtype, and backend evidence.

### `nn.transformer`

- **PyTorch:** `torch.nn.Transformer`, `torch.nn.TransformerEncoder`, `torch.nn.TransformerDecoder`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Transformer containers, masks, nested-tensor fast paths, and encoder and decoder layers are not exposed.
- **Pinned source:** [`torch/nn/modules/transformer.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/nn/modules/transformer.py)
- **Evidence:** —
- **Notes:** Attention kernels and normalization are separate prerequisites.

### `onnx`

- **PyTorch:** `torch.onnx.export`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** ONNX export, diagnostics, shape constraints, and verification are not implemented.
- **Pinned source:** [`torch/onnx/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/onnx/__init__.py)
- **Evidence:** —
- **Notes:** Future support must identify the opset and runtime verification matrix.

### `optim.schedulers`

- **PyTorch:** `torch.optim.lr_scheduler.LRScheduler`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Learning-rate schedulers, metric-driven scheduling, and scheduler checkpoint state are not exposed.
- **Pinned source:** [`torch/optim/lr_scheduler.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/optim/lr_scheduler.py)
- **Evidence:** —
- **Notes:** Future rows must state exact step ordering and state behavior.

### `profiler`

- **PyTorch:** `torch.profiler.profile`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Operator tracing, schedules, memory profiling, stack capture, and trace export are not exposed.
- **Pinned source:** [`torch/profiler/profiler.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/profiler/profiler.py)
- **Evidence:** —
- **Notes:** Future support must keep profiling overhead and backend availability explicit.

### `quantization`

- **PyTorch:** `torch.ao.quantization`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Eager and graph quantization, observers, calibration, fake quantization, and quantized modules are not exposed.
- **Pinned source:** [`torch/ao/quantization/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/ao/quantization/__init__.py)
- **Evidence:** —
- **Notes:** Coverage will distinguish training, post-training, export, dtype, operator, and backend support.

### `sparse`

- **PyTorch:** `torch.sparse`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Sparse layouts, constructors, operators, autograd, validation, and conversion are not exposed.
- **Pinned source:** [`torch/sparse/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/sparse/__init__.py)
- **Evidence:** —
- **Notes:** Future rows will distinguish COO, CSR, CSC, BSR, and BSC.

### `special`

- **PyTorch:** `torch.special`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** The torch.special namespace is not wrapped or compatibility-tested.
- **Pinned source:** [`torch/special/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/special/__init__.py)
- **Evidence:** —
- **Notes:** Future groups require numerical, gradient, dtype, and backend evidence.

### `tabular`

- **PyTorch:** `torch.utils.data.Dataset for tabular records`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** CSV, columnar, database, missing-value, categorical, and numerical preprocessing integrations are not included.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Optional packages will map records into typed samples consumed by the shared loader.

### `testing`

- **PyTorch:** `torch.testing.assert_close`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Public tensor comparison, tolerance policy, generated utilities, and OpInfo-style coverage are not exposed.
- **Pinned source:** [`torch/testing/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/testing/__init__.py)
- **Evidence:** —
- **Notes:** Internal tests are not a public torch.testing surface.

### `text`

- **PyTorch:** `torch.utils.data.Dataset for text samples`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Text decoding, tokenization, vocabulary management, packing, and augmentation are not included.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Optional text packages will produce typed samples for the shared loader.

### `utils.checkpoint`

- **PyTorch:** `torch.utils.checkpoint.checkpoint`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Activation checkpointing, recomputation policy, RNG-state handling, and selective contexts are not exposed.
- **Pinned source:** [`torch/utils/checkpoint.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/checkpoint.py)
- **Evidence:** —
- **Notes:** Future support must prove gradients and memory behavior.

### `video`

- **PyTorch:** `torch.utils.data.Dataset for video samples`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Video decoding, frame sampling, temporal transforms, audio alignment, and batching are not included.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Optional media packages will decode typed samples for the shared loader.

### `vision`

- **PyTorch:** `torch.utils.data.Dataset for image samples`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Image decoding, transforms, augmentation, detection targets, and vision datasets are not included.
- **Pinned source:** [`torch/utils/data/dataset.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataset.py)
- **Evidence:** —
- **Notes:** Optional vision packages will produce typed samples; torchvision is a separate upstream project.

## Python-only

### `compiler.compile`

- **PyTorch:** `torch.compile`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** CPython frame capture, Dynamo guards, and Python graph-break semantics are not native RustTorch APIs.
- **Pinned source:** [`torch/_dynamo/eval_frame.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/_dynamo/eval_frame.py)
- **Evidence:** —
- **Notes:** Rust deployment may consume compatible artifacts later without claiming Python runtime parity.

### `compiler.export`

- **PyTorch:** `torch.export.export`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Python program capture, dynamic Python object handling, and Python-side export diagnostics are not native RustTorch APIs.
- **Pinned source:** [`torch/export/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/export/__init__.py)
- **Evidence:** —
- **Notes:** Capture is tracked separately from planned PT2 artifact interoperability.

### `compiler.fx`

- **PyTorch:** `torch.fx.Graph`, `torch.fx.GraphModule`, `torch.fx.symbolic_trace`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Python symbolic tracing, dynamic module reconstruction, and FX graph compatibility are not provided.
- **Pinned source:** [`torch/fx/graph.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/fx/graph.py)
- **Evidence:** —
- **Notes:** RustTorch's typed graph has separate rows and is not described as FX-compatible.

### `data.dataset.datapipes.decorators`

- **PyTorch:** `torch.utils.data.argument_validation`, `torch.utils.data.functional_datapipe`, `torch.utils.data.guaranteed_datapipes_determinism`, `torch.utils.data.non_deterministic`, `torch.utils.data.runtime_validation`, `torch.utils.data.runtime_validation_disabled`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Python decorators dynamically register DataPipe functions, label determinism, and toggle runtime validation or construction-time determinism contexts.
- **Pinned source:** [`torch/utils/data/datapipes/_decorator.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/datapipes/_decorator.py)
- **Evidence:** —
- **Notes:** Rust traits and the type system provide compile-time composition and validation but are not semantic implementations of these mutable Python registries and context managers.

### `data.internal.exports`

- **PyTorch:** `torch.utils.data._DatasetKind`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** The private loader-kind dispatch enum exported by the pinned module remains a Python implementation detail.
- **Pinned source:** [`torch/utils/data/dataloader.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/utils/data/dataloader.py)
- **Evidence:** —
- **Notes:** RustTorch uses type-state builders instead of exposing Python's internal enum. argument\_validation is separately attributed to the pinned DataPipe decorator module.

## Not supported

### `serialization.pickle`

- **PyTorch:** `torch.save`, `torch.load`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** Arbitrary Python pickle objects, whole-model class reconstruction, and CPython object graphs are intentionally unavailable.
- **Pinned source:** [`torch/serialization.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/serialization.py)
- **Evidence:** —
- **Notes:** RustTorch uses typed model construction and SafeTensors instead of executing pickle payloads.

### `serialization.torchscript`

- **PyTorch:** `torch.jit.load`, `torch.jit.ScriptModule`
- **RustTorch:** —
- **Implementation:** Not implemented
- **Scope:** RustTorch does not expose TorchScript modules or convert TorchScript into eager modules or its graph IR.
- **Pinned source:** [`torch/jit/__init__.py`](https://github.com/pytorch/pytorch/blob/cf30153/torch/jit/__init__.py)
- **Evidence:** —
- **Notes:** Applications may use tch::CModule directly outside the RustTorch contract.