tensorstudio 1.1.0__tar.gz → 1.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/CHANGELOG.md +45 -0
  2. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/PKG-INFO +159 -16
  3. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/README.md +152 -15
  4. tensorstudio-1.3.1/benchmarks/results.md +353 -0
  5. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/results_conv2d.md +39 -39
  6. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/results_matmul.md +45 -45
  7. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/results_pooling.md +45 -45
  8. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/results_reductions.md +75 -75
  9. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/results_tensor_ops.md +309 -309
  10. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Autograde/index.md +9 -1
  11. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Benchmarks/index.md +1 -1
  12. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Hardware/cpu-backend.md +1 -1
  13. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Neural Networks/training.md +23 -1
  14. tensorstudio-1.3.1/docs/Projects/index.md +107 -0
  15. tensorstudio-1.3.1/docs/Roadmap/index.md +197 -0
  16. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Usage/api.md +117 -1
  17. tensorstudio-1.3.1/docs/Usage/interchange.md +68 -0
  18. tensorstudio-1.3.1/docs/Usage/serialization.md +78 -0
  19. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Usage/tensors.md +50 -1
  20. tensorstudio-1.3.1/docs/Vision/index.md +160 -0
  21. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/index.md +24 -12
  22. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/publishing.md +4 -4
  23. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/quickstart.md +78 -2
  24. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/serialization.md +25 -4
  25. tensorstudio-1.3.1/examples/export_onnx.py +29 -0
  26. tensorstudio-1.3.1/examples/image_folder_classification.py +57 -0
  27. tensorstudio-1.3.1/examples/project_training.py +37 -0
  28. tensorstudio-1.3.1/examples/vision_classifier.py +30 -0
  29. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/ops.hpp +8 -0
  30. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/version.hpp +1 -1
  31. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/mkdocs.yml +3 -0
  32. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/pyproject.toml +9 -1
  33. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/_C.pyi +17 -0
  34. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/__init__.py +40 -3
  35. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/_version.py +1 -1
  36. tensorstudio-1.3.1/python/tensorstudio/dtypes.py +91 -0
  37. tensorstudio-1.3.1/python/tensorstudio/interchange/__init__.py +7 -0
  38. tensorstudio-1.3.1/python/tensorstudio/interchange/onnx.py +314 -0
  39. tensorstudio-1.3.1/python/tensorstudio/math.py +82 -0
  40. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/ops.py +40 -0
  41. tensorstudio-1.3.1/python/tensorstudio/project/__init__.py +29 -0
  42. tensorstudio-1.3.1/python/tensorstudio/project/checkpoint.py +91 -0
  43. tensorstudio-1.3.1/python/tensorstudio/project/config.py +115 -0
  44. tensorstudio-1.3.1/python/tensorstudio/project/trainer.py +134 -0
  45. tensorstudio-1.3.1/python/tensorstudio/serialization.py +136 -0
  46. tensorstudio-1.3.1/python/tensorstudio/vision/__init__.py +76 -0
  47. tensorstudio-1.3.1/python/tensorstudio/vision/datasets.py +106 -0
  48. tensorstudio-1.3.1/python/tensorstudio/vision/io.py +113 -0
  49. tensorstudio-1.3.1/python/tensorstudio/vision/metrics.py +113 -0
  50. tensorstudio-1.3.1/python/tensorstudio/vision/models.py +160 -0
  51. tensorstudio-1.3.1/python/tensorstudio/vision/transforms.py +532 -0
  52. tensorstudio-1.3.1/python/tensorstudio/vision/visualization.py +62 -0
  53. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bind_ops.cpp +8 -0
  54. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bind_tensor.cpp +15 -0
  55. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/ops.cpp +157 -0
  56. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/test_all.py +2 -6
  57. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_autograd.py +9 -0
  58. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_import.py +3 -1
  59. tensorstudio-1.3.1/tests/test_interchange.py +62 -0
  60. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_ops.py +31 -0
  61. tensorstudio-1.3.1/tests/test_project.py +78 -0
  62. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_serialization.py +26 -0
  63. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_tensor.py +51 -0
  64. tensorstudio-1.3.1/tests/test_vision.py +144 -0
  65. tensorstudio-1.1.0/benchmarks/results.md +0 -353
  66. tensorstudio-1.1.0/docs/Roadmap/index.md +0 -54
  67. tensorstudio-1.1.0/docs/Usage/serialization.md +0 -43
  68. tensorstudio-1.1.0/python/tensorstudio/serialization.py +0 -34
  69. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.github/workflows/ci.yml +0 -0
  70. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.github/workflows/publish-testpypi.yml +0 -0
  71. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.github/workflows/publish.yml +0 -0
  72. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.github/workflows/wheels.yml +0 -0
  73. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.gitignore +0 -0
  74. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/.pre-commit-config.yaml +0 -0
  75. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/CMakeLists.txt +0 -0
  76. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/CONTRIBUTING.md +0 -0
  77. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/LICENSE +0 -0
  78. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/SECURITY.md +0 -0
  79. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmark_all.py +0 -0
  80. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/__init__.py +0 -0
  81. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_activations.py +0 -0
  82. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_autograd.py +0 -0
  83. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_conv2d.py +0 -0
  84. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_elementwise.py +0 -0
  85. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_matmul.py +0 -0
  86. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_pooling.py +0 -0
  87. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_reductions.py +0 -0
  88. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_tensor_ops.py +0 -0
  89. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/bench_training_loop.py +0 -0
  90. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/benchmarks/benchmark_report.py +0 -0
  91. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Autograde/autograd.md +0 -0
  92. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Hardware/linux.md +0 -0
  93. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Hardware/macos.md +0 -0
  94. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Hardware/windows.md +0 -0
  95. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Neural Networks/modules.md +0 -0
  96. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Neural Networks/nn.md +0 -0
  97. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Usage/data.md +0 -0
  98. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Usage/numpy-interop.md +0 -0
  99. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/Usage/optim.md +0 -0
  100. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/docs/development.md +0 -0
  101. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/examples/basic_tensor_ops.py +0 -0
  102. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/examples/linear_regression.py +0 -0
  103. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/examples/save_load_model.py +0 -0
  104. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/examples/tiny_mlp.py +0 -0
  105. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/autograd.hpp +0 -0
  106. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/device.hpp +0 -0
  107. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/dtype.hpp +0 -0
  108. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/errors.hpp +0 -0
  109. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/module.hpp +0 -0
  110. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/optim.hpp +0 -0
  111. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/random.hpp +0 -0
  112. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/serialization.hpp +0 -0
  113. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/shape.hpp +0 -0
  114. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/storage.hpp +0 -0
  115. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/include/tensorstudio/tensor.hpp +0 -0
  116. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/autograd.py +0 -0
  117. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/data/__init__.py +0 -0
  118. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/data/dataloader.py +0 -0
  119. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/data/dataset.py +0 -0
  120. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/errors.py +0 -0
  121. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/grad_mode.py +0 -0
  122. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/__init__.py +0 -0
  123. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/functional.py +0 -0
  124. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/losses.py +0 -0
  125. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/modules.py +0 -0
  126. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/__init__.py +0 -0
  127. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/adam.py +0 -0
  128. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/adamw.py +0 -0
  129. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/lr_scheduler.py +0 -0
  130. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/sgd.py +0 -0
  131. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/utils.py +0 -0
  132. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/py.typed +0 -0
  133. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/tensor.py +0 -0
  134. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/python/tensorstudio/typing.py +0 -0
  135. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bind_autograd.cpp +0 -0
  136. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bind_nn.cpp +0 -0
  137. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bind_optim.cpp +0 -0
  138. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bindings.cpp +0 -0
  139. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/bindings/bindings.hpp +0 -0
  140. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/autograd.cpp +0 -0
  141. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/device.cpp +0 -0
  142. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/dtype.cpp +0 -0
  143. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/errors.cpp +0 -0
  144. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/module.cpp +0 -0
  145. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/optim.cpp +0 -0
  146. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/random.cpp +0 -0
  147. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/serialization.cpp +0 -0
  148. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/shape.cpp +0 -0
  149. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/storage.cpp +0 -0
  150. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/src/core/tensor.cpp +0 -0
  151. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_benchmark_report.py +0 -0
  152. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_data.py +0 -0
  153. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_nn.py +0 -0
  154. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_numpy_interop.py +0 -0
  155. {tensorstudio-1.1.0 → tensorstudio-1.3.1}/tests/test_optim.py +0 -0
@@ -2,6 +2,51 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 1.3.1 - 2026-07-07
6
+
7
+ - Started the ordered roadmap release train with the dtype-promotion contract.
8
+ - Exposed native `promote_types` plus Python `tensorstudio.dtypes`,
9
+ `promote_types`, `result_type`, `normalize_dtype`, and `dtype_of` helpers.
10
+ - Documented arithmetic, division, and comparison dtype result rules.
11
+ - Added tests that pin binary operation result dtypes across supported dtypes.
12
+
13
+ ## 1.3.0 - 2026-07-07
14
+
15
+ - Expanded `tensorstudio.vision` into a broader computer-vision toolkit with
16
+ image IO, transform pipelines, deterministic augmentation helpers, image
17
+ grids, and bounding-box drawing.
18
+ - Added `ImageFolder` and `ImageList` datasets for local image classification
19
+ workflows.
20
+ - Added classification metrics (`accuracy`, `top_k_accuracy`,
21
+ `confusion_matrix`) and detection utility `box_iou`.
22
+ - Added reusable vision modules `ConvBlock`, `ImageClassifier`, and
23
+ `make_image_classifier`.
24
+ - Updated ONNX export flattening so nested vision model blocks export through
25
+ their supported TensorStudio layers.
26
+ - Added an ImageFolder classification example and expanded vision tests.
27
+ - Added native C++ advanced math ops (`sin`, `cos`, `tan`, `asin`, `acos`,
28
+ `atan`, `log1p`, `rsqrt`) with autograd coverage.
29
+ - Added `tensorstudio.math` helpers for square, reciprocal, variance, standard
30
+ deviation, and norms.
31
+ - Added `tensorstudio.project` with JSON project configs, run folders, a small
32
+ eager `Trainer`, safe NPZ state-dict checkpoints, and trusted full
33
+ checkpoints.
34
+ - Added a project-training example and project workflow tests.
35
+
36
+ ## 1.2.0 - 2026-07-07
37
+
38
+ - Added `save_npz` and `load_npz` for non-pickle tensor and flat
39
+ `state_dict` files using NumPy NPZ archives plus TensorStudio JSON metadata.
40
+ - Added optional ONNX export through `tensorstudio.export_onnx` and
41
+ `tensorstudio.interchange.export_onnx` for supported Sequential module
42
+ stacks.
43
+ - Added `tensorstudio.vision` with image-to-tensor conversion, normalization,
44
+ center crop, nearest-neighbor resize, and a small `TinyConvClassifier`.
45
+ - Added tests for NPZ roundtrips, ONNX graph validation, and vision classifier
46
+ forward/backward behavior.
47
+ - Updated README and MkDocs pages for file formats, ONNX limits, and vision
48
+ workflows.
49
+
5
50
  ## 1.1.0 - 2026-07-07
6
51
 
7
52
  - Added native CPU NCHW `conv2d` with stride, padding, dilation, optional bias,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tensorstudio
3
- Version: 1.1.0
3
+ Version: 1.3.1
4
4
  Summary: TensorStudio is a compact C++ tensor and autograd engine with a Python API for learning, experimentation, and lightweight ML workloads.
5
5
  Keywords: tensor,autograd,machine-learning,cpp,pybind11
6
6
  Author: TensorStudio contributors
@@ -51,9 +51,15 @@ Requires-Dist: ruff>=0.6; extra == "dev"
51
51
  Requires-Dist: mypy>=1.10; extra == "dev"
52
52
  Requires-Dist: cibuildwheel>=2.19; extra == "dev"
53
53
  Requires-Dist: pre-commit>=3.7; extra == "dev"
54
+ Requires-Dist: onnx>=1.16; extra == "dev"
55
+ Requires-Dist: Pillow>=10; extra == "dev"
54
56
  Provides-Extra: docs
55
57
  Requires-Dist: mkdocs>=1.6; extra == "docs"
56
58
  Requires-Dist: mkdocs-material>=9.5; extra == "docs"
59
+ Provides-Extra: onnx
60
+ Requires-Dist: onnx>=1.16; extra == "onnx"
61
+ Provides-Extra: vision
62
+ Requires-Dist: Pillow>=10; extra == "vision"
57
63
  Description-Content-Type: text/markdown
58
64
 
59
65
  # TensorStudio
@@ -65,7 +71,7 @@ Description-Content-Type: text/markdown
65
71
  TensorStudio is a compact C++ tensor and autograd engine with a Python API for
66
72
  learning, experimentation, and lightweight ML workloads.
67
73
 
68
- TensorStudio `1.1.0` is a CPU-only stable API foundation. It is eager-only,
74
+ TensorStudio `1.3.1` is a CPU-only stable API foundation. It is eager-only,
69
75
  intentionally small, and not a replacement for mature ML frameworks.
70
76
 
71
77
  ## Install
@@ -83,6 +89,12 @@ python -m pip install -U pip
83
89
  python -m pip install -e ".[dev]"
84
90
  ```
85
91
 
92
+ Install optional extras for ONNX export and Pillow-backed image inputs:
93
+
94
+ ```bash
95
+ python -m pip install "tensorstudio[onnx,vision]"
96
+ ```
97
+
86
98
  Build source and wheel distributions:
87
99
 
88
100
  ```bash
@@ -158,6 +170,41 @@ print(c.tolist(), d.tolist())
158
170
  print(ts.zeros_like(b).shape, ts.randn_like(b, seed=11).dtype)
159
171
  ```
160
172
 
173
+ Arithmetic promotion is explicit and inspectable:
174
+
175
+ ```python
176
+ print(ts.promote_types("int32", "float32")) # float32
177
+ print(ts.result_type("int64", "int32", op="div")) # float32
178
+ print(ts.result_type("int64", "float32", op="gt")) # bool
179
+ ```
180
+
181
+ ## Advanced Math
182
+
183
+ Native C++ elementwise math includes trigonometric functions and numerically
184
+ useful helpers with autograd support:
185
+
186
+ ```python
187
+ import tensorstudio as ts
188
+
189
+ x = ts.tensor([0.1, 0.2, 0.3], requires_grad=True)
190
+ y = ts.sin(x) + x.cos() + x.log1p() + x.rsqrt()
191
+ loss = y.mean()
192
+ loss.backward()
193
+
194
+ print(loss.item())
195
+ print(x.grad.tolist())
196
+ ```
197
+
198
+ Higher-level helpers live in `tensorstudio.math`:
199
+
200
+ ```python
201
+ values = ts.tensor([[1.0, 2.0], [3.0, 4.0]])
202
+
203
+ print(ts.math.variance(values).item())
204
+ print(ts.math.std(values, axis=0).tolist())
205
+ print(ts.math.norm(values, ord=2).item())
206
+ ```
207
+
161
208
  ## Autograd
162
209
 
163
210
  ```python
@@ -206,6 +253,40 @@ print(model.state_dict().keys())
206
253
  print(model.parameter_count())
207
254
  ```
208
255
 
256
+ ## Vision
257
+
258
+ TensorStudio includes a practical computer-vision namespace for local image
259
+ classification workflows: Pillow-backed image IO, transform pipelines,
260
+ deterministic augmentations, `ImageFolder` datasets, metrics, image grids,
261
+ bounding-box drawing, and compact CNN classifiers running through native
262
+ Conv2d/pooling kernels.
263
+
264
+ ```python
265
+ import numpy as np
266
+ import tensorstudio as ts
267
+ from tensorstudio import nn, optim
268
+
269
+ transform = ts.vision.Compose(
270
+ [
271
+ ts.vision.Resize((8, 8)),
272
+ ts.vision.ToTensor(),
273
+ ts.vision.Normalize(0.5, 0.5),
274
+ ]
275
+ )
276
+ image = np.zeros((8, 8, 3), dtype=np.uint8)
277
+ x = transform(image).reshape((1, 3, 8, 8))
278
+
279
+ model = ts.vision.ImageClassifier((3, 8, 8), num_classes=2, channels=(4,))
280
+ target = ts.tensor([1], dtype="int64")
281
+ optimizer = optim.SGD(model.parameters(), lr=0.01)
282
+
283
+ optimizer.zero_grad()
284
+ loss = nn.CrossEntropyLoss()(model(x), target)
285
+ loss.backward()
286
+ optimizer.step()
287
+ print(ts.vision.accuracy(model(x), target))
288
+ ```
289
+
209
290
  ## DataLoader
210
291
 
211
292
  ```python
@@ -222,6 +303,30 @@ for features, targets in loader:
222
303
  The v1 DataLoader is intentionally single-process so it works cleanly on
223
304
  Windows without multiprocessing setup.
224
305
 
306
+ ## Projects And Training
307
+
308
+ `tensorstudio.project` provides project folders, JSON config, reusable trainers,
309
+ safe NPZ weight files, and trusted full checkpoints:
310
+
311
+ ```python
312
+ import tensorstudio as ts
313
+ from tensorstudio import nn, optim
314
+ from tensorstudio.data import DataLoader, TensorDataset
315
+ from tensorstudio.project import Project, ProjectConfig, Trainer, save_state_dict
316
+
317
+ x = ts.tensor([[0.0], [1.0], [2.0], [3.0]])
318
+ y = ts.tensor([[1.0], [3.0], [5.0], [7.0]])
319
+
320
+ model = nn.Linear(1, 1)
321
+ loader = DataLoader(TensorDataset(x, y), batch_size=2)
322
+ trainer = Trainer(model, optim.SGD(model.parameters(), lr=0.05), nn.MSELoss())
323
+ project = Project("runs/linear", ProjectConfig(name="linear-regression", seed=7))
324
+
325
+ history = trainer.fit(loader, epochs=50)
326
+ save_state_dict(model, project.checkpoint_path("weights"))
327
+ print(history.last)
328
+ ```
329
+
225
330
  ## Performance
226
331
 
227
332
  TensorStudio is optimized for small-to-medium CPU eager workloads, but
@@ -237,10 +342,10 @@ python benchmarks/benchmark_report.py
237
342
  columns for NumPy, TensorFlow, PyTorch, and JAX when those libraries are
238
343
  available locally.
239
344
 
240
- On one Windows CPython 3.10 development run reporting `1.1.0`, TensorStudio
241
- beat NumPy on 23 small operation benchmark cases and lost on 80
242
- NumPy-comparable cases. Against PyTorch CPU `2.12.1+cpu`, TensorStudio won 74
243
- local cases and lost 34. The strongest local wins were small eager operations,
345
+ On one Windows CPython 3.10 development run reporting `1.2.0`, TensorStudio
346
+ beat NumPy on 26 small operation benchmark cases and lost on 77
347
+ NumPy-comparable cases. Against PyTorch CPU `2.12.1+cpu`, TensorStudio won 75
348
+ local cases and lost 33. The strongest local wins were small eager operations,
244
349
  small contiguous axis reductions, and the simple NumPy convolution/pooling
245
350
  references where framework dispatch or Python loops dominate; larger matrix
246
351
  multiplication, PyTorch convolution and pooling, larger axis reductions, larger
@@ -253,15 +358,15 @@ Snapshot from that local run:
253
358
 
254
359
  | operation | shape | TensorStudio | NumPy | PyTorch CPU | TS vs NumPy | TS vs PyTorch |
255
360
  |---|---:|---:|---:|---:|---:|---:|
256
- | `sigmoid` | `(32,)` | 0.0017 ms | 0.0036 ms | 0.0580 ms | 2.1201x | 33.8536x |
257
- | `mean` | `(32,)` | 0.0018 ms | 0.0078 ms | 0.0127 ms | 4.2927x | 7.0047x |
258
- | `sum_axis1` | `(16, 16)` | 0.0021 ms | 0.0029 ms | 0.0068 ms | 1.3727x | 3.2193x |
259
- | `chain_relu` | `(128,)` | 0.0086 ms | 0.0039 ms | 0.0559 ms | 0.4478x | 6.5042x |
260
- | `matmul` | `(256, 256)` | 4.1154 ms | 0.3679 ms | 0.0931 ms | 0.0894x | 0.0226x |
261
- | `conv2d_3x3_padding1` | `(1, 1, 8, 8)` | 0.1788 ms | 1.2241 ms | 0.0131 ms | 6.8478x | 0.0731x |
262
- | `max_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0146 ms | 0.2649 ms | 0.0062 ms | 18.1659x | 0.4242x |
263
- | `avg_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0139 ms | 0.5486 ms | 0.0052 ms | 39.5974x | 0.3748x |
264
- | `elementwise_backward` | `(1024,)` | 2.3885 ms | n/a | 0.1947 ms | n/a | 0.0815x |
361
+ | `sigmoid` | `(32,)` | 0.0017 ms | 0.0038 ms | 0.0614 ms | 2.1691x | 35.3154x |
362
+ | `mean` | `(32,)` | 0.0029 ms | 0.0131 ms | 0.0186 ms | 4.5638x | 6.4709x |
363
+ | `sum_axis1` | `(16, 16)` | 0.0027 ms | 0.0029 ms | 0.0085 ms | 1.0894x | 3.1408x |
364
+ | `chain_relu` | `(128,)` | 0.0112 ms | 0.0051 ms | 0.0726 ms | 0.4575x | 6.4533x |
365
+ | `matmul` | `(256, 256)` | 4.4121 ms | 0.3779 ms | 0.1669 ms | 0.0856x | 0.0378x |
366
+ | `conv2d_3x3_padding1` | `(1, 1, 8, 8)` | 0.2374 ms | 1.7112 ms | 0.0186 ms | 7.2091x | 0.0784x |
367
+ | `max_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0237 ms | 0.2764 ms | 0.0082 ms | 11.6685x | 0.3462x |
368
+ | `avg_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0198 ms | 0.7431 ms | 0.0073 ms | 37.4930x | 0.3662x |
369
+ | `elementwise_backward` | `(1024,)` | 3.0196 ms | n/a | 0.2254 ms | n/a | 0.0746x |
265
370
 
266
371
  Speedup is `competitor median / TensorStudio median`, so values above `1.0x`
267
372
  favor TensorStudio.
@@ -283,6 +388,39 @@ checkpoint = ts.load("checkpoint.tsmodel")
283
388
  Serialization uses pickle. Loading pickle files from untrusted sources is
284
389
  unsafe because pickle can execute arbitrary code.
285
390
 
391
+ For safer tensor and `state_dict` interchange, use TensorStudio's non-pickle
392
+ NPZ helpers:
393
+
394
+ ```python
395
+ state = model.state_dict()
396
+ ts.save_npz(state, "weights.tsnpz")
397
+ model.load_state_dict(ts.load_npz("weights.tsnpz"))
398
+ ```
399
+
400
+ ## ONNX Export
401
+
402
+ TensorStudio can export a supported `nn.Sequential` graph to ONNX when the
403
+ optional `onnx` extra is installed:
404
+
405
+ ```python
406
+ import tensorstudio as ts
407
+ from tensorstudio import nn
408
+
409
+ model = nn.Sequential(
410
+ nn.Conv2d(1, 2, kernel_size=3, padding=1),
411
+ nn.ReLU(),
412
+ nn.MaxPool2d(2),
413
+ nn.Flatten(),
414
+ nn.Linear(2 * 2 * 2, 3),
415
+ )
416
+
417
+ ts.export_onnx(model, "classifier.onnx", input_shape=(1, 1, 4, 4))
418
+ ```
419
+
420
+ The exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
421
+ `Tanh`, `MaxPool2d`, and `AvgPool2d`. It is an exporter, not an ONNX runtime or
422
+ importer.
423
+
286
424
  ## Development
287
425
 
288
426
  ```bash
@@ -329,6 +467,11 @@ tokens or print secrets.
329
467
  - No graph compiler or distributed runtime.
330
468
  - Convolution and pooling support are currently limited to CPU NCHW
331
469
  `conv2d`, `max_pool2d`, and `avg_pool2d` style workloads.
470
+ - Vision covers local image-classification utilities, metrics, visualization,
471
+ and compact CNNs. It is not an OpenCV replacement and does not include
472
+ pretrained model zoos, detection/segmentation training stacks, video IO, or
473
+ GPU image kernels yet.
474
+ - ONNX support is export-only for a limited set of TensorStudio modules.
332
475
  - Reductions support all-element or single-axis reductions, not tuple-axis
333
476
  reductions yet.
334
477
  - No sparse tensors or advanced indexing.
@@ -343,7 +486,7 @@ tokens or print secrets.
343
486
  - Broader convolution ops, adaptive/global pooling, and image-model examples
344
487
  - Richer dataset utilities
345
488
  - Model zoo examples
346
- - ONNX import/export
489
+ - ONNX import and broader export coverage
347
490
  - Improved memory allocator
348
491
  - SIMD kernels
349
492
  - Multithreaded ops
@@ -7,7 +7,7 @@
7
7
  TensorStudio is a compact C++ tensor and autograd engine with a Python API for
8
8
  learning, experimentation, and lightweight ML workloads.
9
9
 
10
- TensorStudio `1.1.0` is a CPU-only stable API foundation. It is eager-only,
10
+ TensorStudio `1.3.1` is a CPU-only stable API foundation. It is eager-only,
11
11
  intentionally small, and not a replacement for mature ML frameworks.
12
12
 
13
13
  ## Install
@@ -25,6 +25,12 @@ python -m pip install -U pip
25
25
  python -m pip install -e ".[dev]"
26
26
  ```
27
27
 
28
+ Install optional extras for ONNX export and Pillow-backed image inputs:
29
+
30
+ ```bash
31
+ python -m pip install "tensorstudio[onnx,vision]"
32
+ ```
33
+
28
34
  Build source and wheel distributions:
29
35
 
30
36
  ```bash
@@ -100,6 +106,41 @@ print(c.tolist(), d.tolist())
100
106
  print(ts.zeros_like(b).shape, ts.randn_like(b, seed=11).dtype)
101
107
  ```
102
108
 
109
+ Arithmetic promotion is explicit and inspectable:
110
+
111
+ ```python
112
+ print(ts.promote_types("int32", "float32")) # float32
113
+ print(ts.result_type("int64", "int32", op="div")) # float32
114
+ print(ts.result_type("int64", "float32", op="gt")) # bool
115
+ ```
116
+
117
+ ## Advanced Math
118
+
119
+ Native C++ elementwise math includes trigonometric functions and numerically
120
+ useful helpers with autograd support:
121
+
122
+ ```python
123
+ import tensorstudio as ts
124
+
125
+ x = ts.tensor([0.1, 0.2, 0.3], requires_grad=True)
126
+ y = ts.sin(x) + x.cos() + x.log1p() + x.rsqrt()
127
+ loss = y.mean()
128
+ loss.backward()
129
+
130
+ print(loss.item())
131
+ print(x.grad.tolist())
132
+ ```
133
+
134
+ Higher-level helpers live in `tensorstudio.math`:
135
+
136
+ ```python
137
+ values = ts.tensor([[1.0, 2.0], [3.0, 4.0]])
138
+
139
+ print(ts.math.variance(values).item())
140
+ print(ts.math.std(values, axis=0).tolist())
141
+ print(ts.math.norm(values, ord=2).item())
142
+ ```
143
+
103
144
  ## Autograd
104
145
 
105
146
  ```python
@@ -148,6 +189,40 @@ print(model.state_dict().keys())
148
189
  print(model.parameter_count())
149
190
  ```
150
191
 
192
+ ## Vision
193
+
194
+ TensorStudio includes a practical computer-vision namespace for local image
195
+ classification workflows: Pillow-backed image IO, transform pipelines,
196
+ deterministic augmentations, `ImageFolder` datasets, metrics, image grids,
197
+ bounding-box drawing, and compact CNN classifiers running through native
198
+ Conv2d/pooling kernels.
199
+
200
+ ```python
201
+ import numpy as np
202
+ import tensorstudio as ts
203
+ from tensorstudio import nn, optim
204
+
205
+ transform = ts.vision.Compose(
206
+ [
207
+ ts.vision.Resize((8, 8)),
208
+ ts.vision.ToTensor(),
209
+ ts.vision.Normalize(0.5, 0.5),
210
+ ]
211
+ )
212
+ image = np.zeros((8, 8, 3), dtype=np.uint8)
213
+ x = transform(image).reshape((1, 3, 8, 8))
214
+
215
+ model = ts.vision.ImageClassifier((3, 8, 8), num_classes=2, channels=(4,))
216
+ target = ts.tensor([1], dtype="int64")
217
+ optimizer = optim.SGD(model.parameters(), lr=0.01)
218
+
219
+ optimizer.zero_grad()
220
+ loss = nn.CrossEntropyLoss()(model(x), target)
221
+ loss.backward()
222
+ optimizer.step()
223
+ print(ts.vision.accuracy(model(x), target))
224
+ ```
225
+
151
226
  ## DataLoader
152
227
 
153
228
  ```python
@@ -164,6 +239,30 @@ for features, targets in loader:
164
239
  The v1 DataLoader is intentionally single-process so it works cleanly on
165
240
  Windows without multiprocessing setup.
166
241
 
242
+ ## Projects And Training
243
+
244
+ `tensorstudio.project` provides project folders, JSON config, reusable trainers,
245
+ safe NPZ weight files, and trusted full checkpoints:
246
+
247
+ ```python
248
+ import tensorstudio as ts
249
+ from tensorstudio import nn, optim
250
+ from tensorstudio.data import DataLoader, TensorDataset
251
+ from tensorstudio.project import Project, ProjectConfig, Trainer, save_state_dict
252
+
253
+ x = ts.tensor([[0.0], [1.0], [2.0], [3.0]])
254
+ y = ts.tensor([[1.0], [3.0], [5.0], [7.0]])
255
+
256
+ model = nn.Linear(1, 1)
257
+ loader = DataLoader(TensorDataset(x, y), batch_size=2)
258
+ trainer = Trainer(model, optim.SGD(model.parameters(), lr=0.05), nn.MSELoss())
259
+ project = Project("runs/linear", ProjectConfig(name="linear-regression", seed=7))
260
+
261
+ history = trainer.fit(loader, epochs=50)
262
+ save_state_dict(model, project.checkpoint_path("weights"))
263
+ print(history.last)
264
+ ```
265
+
167
266
  ## Performance
168
267
 
169
268
  TensorStudio is optimized for small-to-medium CPU eager workloads, but
@@ -179,10 +278,10 @@ python benchmarks/benchmark_report.py
179
278
  columns for NumPy, TensorFlow, PyTorch, and JAX when those libraries are
180
279
  available locally.
181
280
 
182
- On one Windows CPython 3.10 development run reporting `1.1.0`, TensorStudio
183
- beat NumPy on 23 small operation benchmark cases and lost on 80
184
- NumPy-comparable cases. Against PyTorch CPU `2.12.1+cpu`, TensorStudio won 74
185
- local cases and lost 34. The strongest local wins were small eager operations,
281
+ On one Windows CPython 3.10 development run reporting `1.2.0`, TensorStudio
282
+ beat NumPy on 26 small operation benchmark cases and lost on 77
283
+ NumPy-comparable cases. Against PyTorch CPU `2.12.1+cpu`, TensorStudio won 75
284
+ local cases and lost 33. The strongest local wins were small eager operations,
186
285
  small contiguous axis reductions, and the simple NumPy convolution/pooling
187
286
  references where framework dispatch or Python loops dominate; larger matrix
188
287
  multiplication, PyTorch convolution and pooling, larger axis reductions, larger
@@ -195,15 +294,15 @@ Snapshot from that local run:
195
294
 
196
295
  | operation | shape | TensorStudio | NumPy | PyTorch CPU | TS vs NumPy | TS vs PyTorch |
197
296
  |---|---:|---:|---:|---:|---:|---:|
198
- | `sigmoid` | `(32,)` | 0.0017 ms | 0.0036 ms | 0.0580 ms | 2.1201x | 33.8536x |
199
- | `mean` | `(32,)` | 0.0018 ms | 0.0078 ms | 0.0127 ms | 4.2927x | 7.0047x |
200
- | `sum_axis1` | `(16, 16)` | 0.0021 ms | 0.0029 ms | 0.0068 ms | 1.3727x | 3.2193x |
201
- | `chain_relu` | `(128,)` | 0.0086 ms | 0.0039 ms | 0.0559 ms | 0.4478x | 6.5042x |
202
- | `matmul` | `(256, 256)` | 4.1154 ms | 0.3679 ms | 0.0931 ms | 0.0894x | 0.0226x |
203
- | `conv2d_3x3_padding1` | `(1, 1, 8, 8)` | 0.1788 ms | 1.2241 ms | 0.0131 ms | 6.8478x | 0.0731x |
204
- | `max_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0146 ms | 0.2649 ms | 0.0062 ms | 18.1659x | 0.4242x |
205
- | `avg_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0139 ms | 0.5486 ms | 0.0052 ms | 39.5974x | 0.3748x |
206
- | `elementwise_backward` | `(1024,)` | 2.3885 ms | n/a | 0.1947 ms | n/a | 0.0815x |
297
+ | `sigmoid` | `(32,)` | 0.0017 ms | 0.0038 ms | 0.0614 ms | 2.1691x | 35.3154x |
298
+ | `mean` | `(32,)` | 0.0029 ms | 0.0131 ms | 0.0186 ms | 4.5638x | 6.4709x |
299
+ | `sum_axis1` | `(16, 16)` | 0.0027 ms | 0.0029 ms | 0.0085 ms | 1.0894x | 3.1408x |
300
+ | `chain_relu` | `(128,)` | 0.0112 ms | 0.0051 ms | 0.0726 ms | 0.4575x | 6.4533x |
301
+ | `matmul` | `(256, 256)` | 4.4121 ms | 0.3779 ms | 0.1669 ms | 0.0856x | 0.0378x |
302
+ | `conv2d_3x3_padding1` | `(1, 1, 8, 8)` | 0.2374 ms | 1.7112 ms | 0.0186 ms | 7.2091x | 0.0784x |
303
+ | `max_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0237 ms | 0.2764 ms | 0.0082 ms | 11.6685x | 0.3462x |
304
+ | `avg_pool2d_2x2` | `(1, 1, 16, 16)` | 0.0198 ms | 0.7431 ms | 0.0073 ms | 37.4930x | 0.3662x |
305
+ | `elementwise_backward` | `(1024,)` | 3.0196 ms | n/a | 0.2254 ms | n/a | 0.0746x |
207
306
 
208
307
  Speedup is `competitor median / TensorStudio median`, so values above `1.0x`
209
308
  favor TensorStudio.
@@ -225,6 +324,39 @@ checkpoint = ts.load("checkpoint.tsmodel")
225
324
  Serialization uses pickle. Loading pickle files from untrusted sources is
226
325
  unsafe because pickle can execute arbitrary code.
227
326
 
327
+ For safer tensor and `state_dict` interchange, use TensorStudio's non-pickle
328
+ NPZ helpers:
329
+
330
+ ```python
331
+ state = model.state_dict()
332
+ ts.save_npz(state, "weights.tsnpz")
333
+ model.load_state_dict(ts.load_npz("weights.tsnpz"))
334
+ ```
335
+
336
+ ## ONNX Export
337
+
338
+ TensorStudio can export a supported `nn.Sequential` graph to ONNX when the
339
+ optional `onnx` extra is installed:
340
+
341
+ ```python
342
+ import tensorstudio as ts
343
+ from tensorstudio import nn
344
+
345
+ model = nn.Sequential(
346
+ nn.Conv2d(1, 2, kernel_size=3, padding=1),
347
+ nn.ReLU(),
348
+ nn.MaxPool2d(2),
349
+ nn.Flatten(),
350
+ nn.Linear(2 * 2 * 2, 3),
351
+ )
352
+
353
+ ts.export_onnx(model, "classifier.onnx", input_shape=(1, 1, 4, 4))
354
+ ```
355
+
356
+ The exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
357
+ `Tanh`, `MaxPool2d`, and `AvgPool2d`. It is an exporter, not an ONNX runtime or
358
+ importer.
359
+
228
360
  ## Development
229
361
 
230
362
  ```bash
@@ -271,6 +403,11 @@ tokens or print secrets.
271
403
  - No graph compiler or distributed runtime.
272
404
  - Convolution and pooling support are currently limited to CPU NCHW
273
405
  `conv2d`, `max_pool2d`, and `avg_pool2d` style workloads.
406
+ - Vision covers local image-classification utilities, metrics, visualization,
407
+ and compact CNNs. It is not an OpenCV replacement and does not include
408
+ pretrained model zoos, detection/segmentation training stacks, video IO, or
409
+ GPU image kernels yet.
410
+ - ONNX support is export-only for a limited set of TensorStudio modules.
274
411
  - Reductions support all-element or single-axis reductions, not tuple-axis
275
412
  reductions yet.
276
413
  - No sparse tensors or advanced indexing.
@@ -285,7 +422,7 @@ tokens or print secrets.
285
422
  - Broader convolution ops, adaptive/global pooling, and image-model examples
286
423
  - Richer dataset utilities
287
424
  - Model zoo examples
288
- - ONNX import/export
425
+ - ONNX import and broader export coverage
289
426
  - Improved memory allocator
290
427
  - SIMD kernels
291
428
  - Multithreaded ops