tensorstudio 1.2.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 (157) hide show
  1. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/CHANGELOG.md +31 -0
  2. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/PKG-INFO +81 -12
  3. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/README.md +80 -11
  4. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results.md +353 -353
  5. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results_conv2d.md +39 -39
  6. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results_matmul.md +45 -45
  7. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results_pooling.md +45 -45
  8. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results_reductions.md +75 -75
  9. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/results_tensor_ops.md +309 -309
  10. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Autograde/index.md +9 -1
  11. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Benchmarks/index.md +1 -1
  12. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Hardware/cpu-backend.md +1 -1
  13. {tensorstudio-1.2.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.2.0 → tensorstudio-1.3.1}/docs/Usage/api.md +92 -0
  17. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Usage/interchange.md +3 -3
  18. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Usage/serialization.md +1 -1
  19. {tensorstudio-1.2.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.2.0 → tensorstudio-1.3.1}/docs/index.md +18 -11
  22. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/publishing.md +4 -4
  23. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/quickstart.md +40 -6
  24. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/serialization.md +1 -1
  25. tensorstudio-1.3.1/examples/image_folder_classification.py +57 -0
  26. tensorstudio-1.3.1/examples/project_training.py +37 -0
  27. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/ops.hpp +8 -0
  28. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/version.hpp +1 -1
  29. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/mkdocs.yml +1 -0
  30. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/pyproject.toml +1 -1
  31. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/_C.pyi +17 -0
  32. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/__init__.py +33 -2
  33. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/_version.py +1 -1
  34. tensorstudio-1.3.1/python/tensorstudio/dtypes.py +91 -0
  35. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/interchange/onnx.py +25 -10
  36. tensorstudio-1.3.1/python/tensorstudio/math.py +82 -0
  37. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/ops.py +40 -0
  38. tensorstudio-1.3.1/python/tensorstudio/project/__init__.py +29 -0
  39. tensorstudio-1.3.1/python/tensorstudio/project/checkpoint.py +91 -0
  40. tensorstudio-1.3.1/python/tensorstudio/project/config.py +115 -0
  41. tensorstudio-1.3.1/python/tensorstudio/project/trainer.py +134 -0
  42. tensorstudio-1.3.1/python/tensorstudio/vision/__init__.py +76 -0
  43. tensorstudio-1.3.1/python/tensorstudio/vision/datasets.py +106 -0
  44. tensorstudio-1.3.1/python/tensorstudio/vision/io.py +113 -0
  45. tensorstudio-1.3.1/python/tensorstudio/vision/metrics.py +113 -0
  46. tensorstudio-1.3.1/python/tensorstudio/vision/models.py +160 -0
  47. tensorstudio-1.3.1/python/tensorstudio/vision/transforms.py +532 -0
  48. tensorstudio-1.3.1/python/tensorstudio/vision/visualization.py +62 -0
  49. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bind_ops.cpp +8 -0
  50. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bind_tensor.cpp +15 -0
  51. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/ops.cpp +157 -0
  52. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_autograd.py +9 -0
  53. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_import.py +1 -1
  54. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_interchange.py +19 -0
  55. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_ops.py +31 -0
  56. tensorstudio-1.3.1/tests/test_project.py +78 -0
  57. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_tensor.py +51 -0
  58. tensorstudio-1.3.1/tests/test_vision.py +144 -0
  59. tensorstudio-1.2.0/docs/Roadmap/index.md +0 -54
  60. tensorstudio-1.2.0/docs/Vision/index.md +0 -83
  61. tensorstudio-1.2.0/python/tensorstudio/vision/__init__.py +0 -15
  62. tensorstudio-1.2.0/python/tensorstudio/vision/models.py +0 -59
  63. tensorstudio-1.2.0/python/tensorstudio/vision/transforms.py +0 -184
  64. tensorstudio-1.2.0/tests/test_vision.py +0 -52
  65. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.github/workflows/ci.yml +0 -0
  66. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.github/workflows/publish-testpypi.yml +0 -0
  67. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.github/workflows/publish.yml +0 -0
  68. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.github/workflows/wheels.yml +0 -0
  69. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.gitignore +0 -0
  70. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/.pre-commit-config.yaml +0 -0
  71. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/CMakeLists.txt +0 -0
  72. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/CONTRIBUTING.md +0 -0
  73. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/LICENSE +0 -0
  74. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/SECURITY.md +0 -0
  75. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmark_all.py +0 -0
  76. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/__init__.py +0 -0
  77. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_activations.py +0 -0
  78. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_autograd.py +0 -0
  79. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_conv2d.py +0 -0
  80. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_elementwise.py +0 -0
  81. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_matmul.py +0 -0
  82. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_pooling.py +0 -0
  83. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_reductions.py +0 -0
  84. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_tensor_ops.py +0 -0
  85. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/bench_training_loop.py +0 -0
  86. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/benchmarks/benchmark_report.py +0 -0
  87. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Autograde/autograd.md +0 -0
  88. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Hardware/linux.md +0 -0
  89. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Hardware/macos.md +0 -0
  90. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Hardware/windows.md +0 -0
  91. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Neural Networks/modules.md +0 -0
  92. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Neural Networks/nn.md +0 -0
  93. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Usage/data.md +0 -0
  94. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Usage/numpy-interop.md +0 -0
  95. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/Usage/optim.md +0 -0
  96. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/docs/development.md +0 -0
  97. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/basic_tensor_ops.py +0 -0
  98. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/export_onnx.py +0 -0
  99. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/linear_regression.py +0 -0
  100. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/save_load_model.py +0 -0
  101. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/tiny_mlp.py +0 -0
  102. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/examples/vision_classifier.py +0 -0
  103. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/autograd.hpp +0 -0
  104. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/device.hpp +0 -0
  105. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/dtype.hpp +0 -0
  106. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/errors.hpp +0 -0
  107. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/module.hpp +0 -0
  108. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/optim.hpp +0 -0
  109. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/random.hpp +0 -0
  110. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/serialization.hpp +0 -0
  111. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/shape.hpp +0 -0
  112. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/storage.hpp +0 -0
  113. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/include/tensorstudio/tensor.hpp +0 -0
  114. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/autograd.py +0 -0
  115. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/data/__init__.py +0 -0
  116. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/data/dataloader.py +0 -0
  117. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/data/dataset.py +0 -0
  118. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/errors.py +0 -0
  119. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/grad_mode.py +0 -0
  120. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/interchange/__init__.py +0 -0
  121. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/__init__.py +0 -0
  122. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/functional.py +0 -0
  123. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/losses.py +0 -0
  124. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/nn/modules.py +0 -0
  125. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/__init__.py +0 -0
  126. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/adam.py +0 -0
  127. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/adamw.py +0 -0
  128. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/lr_scheduler.py +0 -0
  129. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/sgd.py +0 -0
  130. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/optim/utils.py +0 -0
  131. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/py.typed +0 -0
  132. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/serialization.py +0 -0
  133. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/tensor.py +0 -0
  134. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/python/tensorstudio/typing.py +0 -0
  135. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bind_autograd.cpp +0 -0
  136. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bind_nn.cpp +0 -0
  137. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bind_optim.cpp +0 -0
  138. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bindings.cpp +0 -0
  139. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/bindings/bindings.hpp +0 -0
  140. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/autograd.cpp +0 -0
  141. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/device.cpp +0 -0
  142. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/dtype.cpp +0 -0
  143. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/errors.cpp +0 -0
  144. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/module.cpp +0 -0
  145. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/optim.cpp +0 -0
  146. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/random.cpp +0 -0
  147. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/serialization.cpp +0 -0
  148. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/shape.cpp +0 -0
  149. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/storage.cpp +0 -0
  150. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/src/core/tensor.cpp +0 -0
  151. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/test_all.py +0 -0
  152. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_benchmark_report.py +0 -0
  153. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_data.py +0 -0
  154. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_nn.py +0 -0
  155. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_numpy_interop.py +0 -0
  156. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_optim.py +0 -0
  157. {tensorstudio-1.2.0 → tensorstudio-1.3.1}/tests/test_serialization.py +0 -0
@@ -2,6 +2,37 @@
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
+
5
36
  ## 1.2.0 - 2026-07-07
6
37
 
7
38
  - Added `save_npz` and `load_npz` for non-pickle tensor and flat
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tensorstudio
3
- Version: 1.2.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
@@ -71,7 +71,7 @@ Description-Content-Type: text/markdown
71
71
  TensorStudio is a compact C++ tensor and autograd engine with a Python API for
72
72
  learning, experimentation, and lightweight ML workloads.
73
73
 
74
- TensorStudio `1.2.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,
75
75
  intentionally small, and not a replacement for mature ML frameworks.
76
76
 
77
77
  ## Install
@@ -170,6 +170,41 @@ print(c.tolist(), d.tolist())
170
170
  print(ts.zeros_like(b).shape, ts.randn_like(b, seed=11).dtype)
171
171
  ```
172
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
+
173
208
  ## Autograd
174
209
 
175
210
  ```python
@@ -220,21 +255,28 @@ print(model.parameter_count())
220
255
 
221
256
  ## Vision
222
257
 
223
- TensorStudio includes a small vision namespace for image preprocessing and
224
- compact CNN classifiers. Image file decoding remains the job of Pillow or other
225
- image libraries; TensorStudio converts image-like arrays into channel-first
226
- tensors and runs the model with its native Conv2d and pooling kernels.
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.
227
263
 
228
264
  ```python
229
265
  import numpy as np
230
266
  import tensorstudio as ts
231
267
  from tensorstudio import nn, optim
232
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
+ )
233
276
  image = np.zeros((8, 8, 3), dtype=np.uint8)
234
- x = ts.vision.to_tensor(image).reshape((1, 3, 8, 8))
235
- x = ts.vision.normalize(x, mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))
277
+ x = transform(image).reshape((1, 3, 8, 8))
236
278
 
237
- model = ts.vision.TinyConvClassifier((3, 8, 8), num_classes=2)
279
+ model = ts.vision.ImageClassifier((3, 8, 8), num_classes=2, channels=(4,))
238
280
  target = ts.tensor([1], dtype="int64")
239
281
  optimizer = optim.SGD(model.parameters(), lr=0.01)
240
282
 
@@ -242,6 +284,7 @@ optimizer.zero_grad()
242
284
  loss = nn.CrossEntropyLoss()(model(x), target)
243
285
  loss.backward()
244
286
  optimizer.step()
287
+ print(ts.vision.accuracy(model(x), target))
245
288
  ```
246
289
 
247
290
  ## DataLoader
@@ -260,6 +303,30 @@ for features, targets in loader:
260
303
  The v1 DataLoader is intentionally single-process so it works cleanly on
261
304
  Windows without multiprocessing setup.
262
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
+
263
330
  ## Performance
264
331
 
265
332
  TensorStudio is optimized for small-to-medium CPU eager workloads, but
@@ -350,7 +417,7 @@ model = nn.Sequential(
350
417
  ts.export_onnx(model, "classifier.onnx", input_shape=(1, 1, 4, 4))
351
418
  ```
352
419
 
353
- The v1.2 exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
420
+ The exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
354
421
  `Tanh`, `MaxPool2d`, and `AvgPool2d`. It is an exporter, not an ONNX runtime or
355
422
  importer.
356
423
 
@@ -400,8 +467,10 @@ tokens or print secrets.
400
467
  - No graph compiler or distributed runtime.
401
468
  - Convolution and pooling support are currently limited to CPU NCHW
402
469
  `conv2d`, `max_pool2d`, and `avg_pool2d` style workloads.
403
- - Vision utilities are preprocessing and small CNN helpers, not a full computer
404
- vision library.
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.
405
474
  - ONNX support is export-only for a limited set of TensorStudio modules.
406
475
  - Reductions support all-element or single-axis reductions, not tuple-axis
407
476
  reductions yet.
@@ -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.2.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
@@ -106,6 +106,41 @@ print(c.tolist(), d.tolist())
106
106
  print(ts.zeros_like(b).shape, ts.randn_like(b, seed=11).dtype)
107
107
  ```
108
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
+
109
144
  ## Autograd
110
145
 
111
146
  ```python
@@ -156,21 +191,28 @@ print(model.parameter_count())
156
191
 
157
192
  ## Vision
158
193
 
159
- TensorStudio includes a small vision namespace for image preprocessing and
160
- compact CNN classifiers. Image file decoding remains the job of Pillow or other
161
- image libraries; TensorStudio converts image-like arrays into channel-first
162
- tensors and runs the model with its native Conv2d and pooling kernels.
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.
163
199
 
164
200
  ```python
165
201
  import numpy as np
166
202
  import tensorstudio as ts
167
203
  from tensorstudio import nn, optim
168
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
+ )
169
212
  image = np.zeros((8, 8, 3), dtype=np.uint8)
170
- x = ts.vision.to_tensor(image).reshape((1, 3, 8, 8))
171
- x = ts.vision.normalize(x, mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))
213
+ x = transform(image).reshape((1, 3, 8, 8))
172
214
 
173
- model = ts.vision.TinyConvClassifier((3, 8, 8), num_classes=2)
215
+ model = ts.vision.ImageClassifier((3, 8, 8), num_classes=2, channels=(4,))
174
216
  target = ts.tensor([1], dtype="int64")
175
217
  optimizer = optim.SGD(model.parameters(), lr=0.01)
176
218
 
@@ -178,6 +220,7 @@ optimizer.zero_grad()
178
220
  loss = nn.CrossEntropyLoss()(model(x), target)
179
221
  loss.backward()
180
222
  optimizer.step()
223
+ print(ts.vision.accuracy(model(x), target))
181
224
  ```
182
225
 
183
226
  ## DataLoader
@@ -196,6 +239,30 @@ for features, targets in loader:
196
239
  The v1 DataLoader is intentionally single-process so it works cleanly on
197
240
  Windows without multiprocessing setup.
198
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
+
199
266
  ## Performance
200
267
 
201
268
  TensorStudio is optimized for small-to-medium CPU eager workloads, but
@@ -286,7 +353,7 @@ model = nn.Sequential(
286
353
  ts.export_onnx(model, "classifier.onnx", input_shape=(1, 1, 4, 4))
287
354
  ```
288
355
 
289
- The v1.2 exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
356
+ The exporter supports `Linear`, `Conv2d`, `Flatten`, `ReLU`, `Sigmoid`,
290
357
  `Tanh`, `MaxPool2d`, and `AvgPool2d`. It is an exporter, not an ONNX runtime or
291
358
  importer.
292
359
 
@@ -336,8 +403,10 @@ tokens or print secrets.
336
403
  - No graph compiler or distributed runtime.
337
404
  - Convolution and pooling support are currently limited to CPU NCHW
338
405
  `conv2d`, `max_pool2d`, and `avg_pool2d` style workloads.
339
- - Vision utilities are preprocessing and small CNN helpers, not a full computer
340
- vision library.
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.
341
410
  - ONNX support is export-only for a limited set of TensorStudio modules.
342
411
  - Reductions support all-element or single-axis reductions, not tuple-axis
343
412
  reductions yet.