Commit Graph

207 Commits

Author SHA1 Message Date
Jan Hohenheim 3b4974f011
Fix tiny typo in mathematical expression (#2867) 2025-03-04 12:12:57 -05:00
Guillaume Lagrange a6b5210aee
Feat/quant/per block (#2849)
* Refactor scheme to have quantization mode + add per-block variant

* Add per-block calibration range

* Add per-block qparams compute

* Update book

* Add per-block quantization strategy

* Working per-block tests

* Remove dead code

* Quantize works

* Dequantize works

* TODO

* Add test with block_size > line_size

* Clean up

* Fix clippy + typos

* Fix no-std

* Add might_panic test attribute

* Feature gate might_panic for no-std

* Add from/to data tests + make panic reason more specific

* We forgot default std

* WIP macos debug

* More debug

* Debug

* Fix precision issues

* Debug ci

* More ci

* Clean up ci

* Remove todo comment

* Remove comment
2025-03-03 12:59:25 -05:00
Msa360 925716f89d
Feat: Add tan trig function (#2854)
* Add tan operation

Added tan op in FloatTensorOps and QTensorOps, with tests.
Bootstrapped with sin/cos ops, complete backend abstraction.

* update burn-book

* add ONNX support for tan

* add clone_invariance test

* cargo fmt
2025-03-03 10:04:04 -05:00
Guillaume Lagrange 2127c9293e
Fix from_embedded and bool ops docs (#2848) 2025-02-28 15:48:26 -05:00
Nathaniel Simard d9e41460ff
Refactor burn jit => burn-cubecl (#2809) 2025-02-13 12:39:29 -05:00
Guillaume Lagrange a9d583b5b4
Add metric parametrized name (#2808)
* Add metric parameterized name

* Update custom metric book

* Add missing adaptor for top-k acc

* Remove const name
2025-02-13 10:57:54 -05:00
SalvoMcL 9f003203d0
Feat: Add PoissonNLL loss (#2765)
* added PoissonNLLLossConfig

* added PoissonNLLLoss

* added tests

* update docs

* added requested changes
2025-02-03 10:05:14 -05:00
Cameron Braid 894fdbc54a
typo - missing `tick` which was breaking formatting (#2745) 2025-01-27 08:21:15 -05:00
Cameron Braid 51a29730a1
typo - correct `smp_serde` to `rmp_serde` as per crate's name in url (#2744) 2025-01-27 08:20:34 -05:00
quinton e73c2d967b
feat: bitwise-ops-for-tensors (#2498)
* feat: bitwise-ops-for-tensors

* add bitwise ops for jit

* patch: address-requested-changes

* feat: jit-binary-int-ops

* cargo lock

* feat: jit-backend bitwise not unary op

* feat: bitwise left shift and right shift ops

* patch: resolve review request changes

* patch: remove-dtype-int-op-desc

* refactor requested changes

* Add bitwise int ops to book + remove dead code

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2025-01-24 09:07:15 -05:00
Kai Shang e40c69b893
Fixed typo in the burn book chapter advanced unit no-std. (#2731)
* Fixed typo in the burn book chapter advanced unit no-std.

"deice" -> "device"

* Fixed typo in the accompanying example as well.
2025-01-22 16:06:07 -05:00
jiawen wang f630b3bc7d
Wasserstein Generative Adversarial Network (#2660)
* Add files via upload

Wasserstein Generative Adversarial Network

* Delete examples/wgan/readme

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update cli.rs

* Update cli.rs

* Update model.rs

* Update training.rs

* Update main.rs

* Update model.rs

* Update training.rs

* Update training.rs

* Update main.rs

* Update training.rs

* Update model.rs

* Update training.rs

* Update cli.rs

* Update cli.rs

* Update generating.rs

* Update lib.rs

* Update model.rs

* Update training.rs

* Update main.rs

* Update generating.rs

* Update model.rs

* Update training.rs

* Update generating.rs

* Update model.rs

* Update training.rs

* Update training.rs

* Update dataset.rs

* Update generating.rs

* Update model.rs

* Update training.rs

* Update training.rs

* Update training.rs

* Restructure as workspace example

* Add support for single range slice (fixes clippy)

* Update example usage + list

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2025-01-15 11:45:20 -05:00
tiruka ad81344821
Feature add new one hot function meeting multi-dimensions (ranks) (#2613)
* add one hot with axis and values function

* update one hot multidimentional function

* implementing on numeric.rs

* update one hot method in numeric

* update one hot function to deal with additional dims
add one hot test

* added tests for one hot

* modify function name
modify format
add tests

* modify to respond to difference between Tensor type and values type

* fix clippy point out and doc test

* do refactoring
modify comments

* update burn book to publish one hot plus method

* modify one_hot_plus to one_hot_fill and args names

* modify one_hot function in int impl and float impl
modify one_hot tests

* modify numeric to clear logic

* modify miscs due to validation, linnter and formatter

* modify documents for tensor api

* modify codes to follow review comments

* modify codes to follow reviews

* modify tests to follow reviews comments

* Improve check message

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2025-01-15 11:44:50 -05:00
Guillaume Lagrange 93cafc41b5
Bump next version of Burn to 0.17.0 (#2698) 2025-01-14 18:43:58 -05:00
kitterion ad89dcc0e4
Don't mention a fixed candle bug (#2689) 2025-01-13 09:10:07 -05:00
Guillaume Lagrange 7c2d590bfe
Fix load_file usage to keep using model (#2672) 2025-01-08 11:46:13 -05:00
Tiago Sanona a644430b0a
add fscore, reorganize mod and change error in doc. (#2648)
* add fscore, reorganize mod and change error in doc.

* add function args to doc

* fscore to fbetascore and formatting metrics doc in book

* Minor doc fixes

---------

Co-authored-by: Tiago Sanona <tsanona@gmail.com>
Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2025-01-07 15:08:27 -05:00
Tiago Sanona 676877a5e4
Add recall (#2518)
* create ClassificationInput and ClassificationConfig to share code with RecallMetric. Adapt confusionStats and Precision with generalized code.

* adjust comments in dummy data. implement recall. optimize imports and rename test function properly in precision.

* update book

* rename ClassificationInput, compose ClassificationConfig as classification decision rule and class_reduction

* format

* no glob import

* add comment and fmt

* rename struct slight reorganization add comments

* add documentation to DecisionRule's branches

---------

Co-authored-by: Tiago Sanona <tsanona@gmail.com>
2024-12-20 11:36:17 -05:00
Guillaume Lagrange 9edeb67aa7
Add Clamp module mapper implementation w/ autodiff backend (#2632) 2024-12-20 11:04:25 -05:00
Sergey 'Jin' Bostandzhyan a882843294
Extend ImageFolderDataset to support import of COCO detection (#2612)
COCO is a popular dataset which defines an own dataset format:
https://cocodataset.org/#format-data

This commit introduces a ImageFolderDataset::new_coco_detection()
function, which expects a path to the JSON annotations file in COCO
format and a path where the actual images are stored.

Note, that while COCO also offers segmentation and pose estimation data,
for now only the import of detection (bounding boxes) data is supported.
2024-12-20 08:04:54 -05:00
Guillaume Lagrange 8a89293bf3
Add module mapper book example (#2621)
* Add module mapper example

* Fix handles typo
2024-12-16 11:44:14 -05:00
Guillaume Lagrange 834ff44098
Fix module visitor and mapper trait definition in the book (#2609) 2024-12-13 14:58:24 -05:00
Guillaume Lagrange 33cbb3b673
Remove precision bridge and complete `float_cast` implementation for ndarray (#2538) 2024-11-28 08:28:59 -05:00
Vincent Masse a35321c8b3
Add option to request manual quit on tui (#2489)
* Add option to request manual quit on tui

* Update book

* Update post training implementation for TUI

* Make tui public

* Rename manual_quit to persistent

---------

Co-authored-by: Vincent Masse <you@example.com>
2024-11-25 09:56:14 -05:00
Guillaume Lagrange 9a2b841665
Add float cast op for JIT backend (#2511)
* Fix backend FloatElem docstring

* Remove elem type generic from JitTensor (float ops still using default dtype)

* Use execute_with_dtype macro for float ops

* Add cast for fusion

* Add warning for type promotion

* Add cast to backend router

* Add Primitive trait to correctly display the tensor dtype

* Fix primtiive associated type

* Fix jit bool tensor display

* Fix CI

* Fix clippy

* Whoops

* Fix candle bool tensor display

* Add shape to primitive trait

* Add primitive tests

* Rename trait to TensorMetadata

* Add missing changes to example

* Fix split from merge
2024-11-21 13:19:33 -05:00
Tiago Sanona a6c7a2b0c4
Add test int one_hot and change ops docs in the book (#2519)
* add int one_hot tests, change tensor creation function formatting in book.

* move swap_dims and transpose to basic ops in book.

---------

Co-authored-by: Tiago Sanona <tsanona@gmail.com>
2024-11-21 11:51:48 -05:00
Mathias Insley d1398d6068
Feat/Split Operator (#2490) 2024-11-21 09:59:00 -05:00
Tiago Sanona 76e67bf059
Add precision classification metric (#2293)
* Implement confusion matrix and precision, first draft

* Implement confusion matrix

* format :D

* add agg type to cm, reformat debug representation add testing.
improve dummy classification input.
reformat precision and add test with dummy data.

* formating and tiny refactor

* add ClassificationMetric trait, rename variables and types, move test module to lib.rs make precision a classification metric.

* change unwrap to expect

* update book

* remove unused code

* changes to make reusing code easier

* format :D

* change to static data tests

* remove classification metric trait, add auxiliary code for  classification input, clarify descriptions, remove dead code, rename some objects

* move classification objects to classification.rs, use rstest, remove approx lib and use tensordata asserts, move aggregate and average functions to ConfusionStats implementation

* review docstring, add top_k for multiclass tasks.

* move class averaging and metric computation to metric implementation, make dummy data more predictable and add tests for top_k > 1

* change struct and var names

* rename params, enforce nonzero for top_k param, optimize one_hot for case num_class = 1, reformat dummy data, make use of derive(new) for metric init.

* add adaptor por classification input, correct one hot function

* define default for ClassReduction, derive new for Precision metric with class_reduction as default and new setter implementation, move NonZerousize boundary to confusion_stats

* expose PrecisionMetric, change metric initialization

* check one_hot input tensor has more than 1 classes and correct it's implementation, deal with classification output with 1 class, make macro average default, expose ClassReduction type and split precision implementations by classification type

* implement adaptor for MultilabelClassificationOutput and ClassificationInput

* change with_top_k to take usize

* Add precision config for binary, multiclass and multilabel

* Fix dummy_classification_input

* make PrecisionMetric public

---------

Co-authored-by: Tiago Sanona <tsanona@gmail.com>
Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2024-11-20 09:43:15 -05:00
Anthony Torlucci eac60d760b
Add segmentation mask to burn book (#2495) 2024-11-18 08:15:15 -05:00
Guillaume Lagrange 56dc4c0252
Add float cast tensor op (#2483)
* Remove elem type generic from TchTensor

* Remove elem type generic from CandleTensor

* Add float cast tensor op

* Add float tensor cast to book

* Fix candle into_data for int dtypes

* Fix fmt

* Fix clippy

* Add dtype check to test

* Edit type promotion comment

* Clean up candle into_data

* Add candle float cast
2024-11-18 08:08:33 -05:00
Guillaume Lagrange f8c845d42a
Fix unsqueeze dims with multiple trailing negative indices (#2496) 2024-11-18 08:08:07 -05:00
Vincent Masse 94db460ddf
Add ROC AUC metric (#2466)
* Add ROC AUC metric

* Update burn book

* Change ROC AUC for auroc

* Return 0 if all same target value and Warn

---------

Co-authored-by: Vincent Masse <you@example.com>
2024-11-13 08:15:41 -05:00
Arthur Brussee 8e466d7ce1
DefaultDevice should be an alias of BestAvailable (#2443)
* BestAvailable should be an alias

* Fix an old reference
2024-10-31 12:03:52 -04:00
Guillaume Lagrange b8e47dabe3
Bump next version of Burn to 0.16.0 (#2434) 2024-10-28 16:41:58 -04:00
Tiago Sanona 2775ec3fbe
Add `tensor.one_hot` int operation (#2413)
* make zero_like, ones_like and full_like general numeric tensor functions,
correct some docs.

* add argtopk

* rename one_hot, correct float one_hot doc in book

* remove argtopk

* correct funtion name in book

---------

Co-authored-by: Tiago Sanona <tsanona@gmail.com>
2024-10-25 14:18:02 -04:00
Genna Wingert d5e8e3185c
Add documentation for custom `cubecl` kernels, update some outdated docs (#2404) 2024-10-25 13:22:23 -04:00
Guillaume Lagrange 09c65ca20f
Improve regression example (#2405) 2024-10-24 16:23:12 -04:00
med1844 6515a081aa
Add `round`, `floor`, `ceil` for float tensor (#2372)
* Add round, floor, ceil into FloatTensorOps trait; Impl round, floor, ceil for tensor, tch, ndarray, candle; Add tests for autodiff

* Add test for round, floor, ceil in burn tensor backend

* Add test for round, floor, ceil in burn candle backend

* Impl round, floor, ceil for burn fushion backend

* Update burn book

* Fix round gradient != 0 issue

* Add tests for halfway cases

* Use `round_ties_even` for `round` in ndarray backend

* Impl round to even for candle

* Add round, floor, ceil for burn router

* Add round, floor, ceil for jit backend; Upgrade cubecl

* Add round_ties_even for no-std in ndarray backend

* Be explicit about what rounding strategy is used

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2024-10-21 12:18:43 -04:00
Noah Schiro 3d77efc305
Softmin (#2358) 2024-10-15 15:34:16 -04:00
Nico Zweifel 35bb19aae1
Windows/WindowsIterator/WindowsDataset (#2338)
* Windows/WindowIterator/WindowDataset

* naming

* naming/book

* fix: format

* move to `tranform` folder

* format

* fix: summary/example imports

* fix: docs/import

* fix: generics

* cleanup

* chore: format/cleanup

* chore: update summarry

* chore: keep window.rs naming

* chore: summary

* fix: book table

* chore: summary fix

* chore: fix summary

* chore: fix summary

* chore: fix summaries

* chore: fix summaries

* add missing test coverage
2024-10-15 08:59:13 -04:00
Arthur Brussee dbd577a5c2
Add utility methods to split gradients to GradientParams (#2311)
* Add utility methods to split gradients to GradientParams

* Forget about from_segments for now

* ParamId -> u64

* Fix test

* Don't need two lifetimes

* Backwards compatibilty deserialization

* Always serialize same format

* Better compat with old formats

* Fix no_std

* Add a bit to the book

* Move deserialize function, add test

* Tweak test

* Add backward compat for 16-byte uuid

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2024-10-04 09:16:11 -04:00
Guillaume Lagrange a6f7a5e532
Remove const D generic (#2298)
* Remove const D generic

* Missing merge conflicts
2024-09-24 08:35:52 -04:00
Genna Wingert 2c8514ce7f
Add deform_conv2d as implemented in torchvision (#2147) 2024-09-23 15:17:23 -04:00
Mehmet Ali Anil 3d91b40005
fixed path (#2262) 2024-09-09 10:29:27 -04:00
Guillaume Lagrange 7baa33bdaa
Fix target convert in batcher and align guide imports (#2215)
* Fix target convert in batcher

* Align hidden code in training and update loss to use config

* Align imports with example

* Remove unused import and fix guide->crate
2024-08-29 08:58:51 -04:00
Guillaume Lagrange 40d321cc0d
Fix tensor data elem type conversion in book (#2211) 2024-08-28 10:55:10 -04:00
syl20bnr a600a7b54e Bump Burn version in the Burn Book 2024-08-27 15:13:40 -04:00
syl20bnr 8e78106680 Bump burn version to 0.15.0 2024-08-27 15:13:40 -04:00
Bjorn Beishline 17de832c6e
Make compatible with thumbv6m-none-eabi + add raspberry pi pico example (#2096)
* Made compatible with thumbv6m-none-eabi

* Added example of no_std on rp2040

* Added documentation on usage in no_std

* Rename rp2040 example and add README.md
2024-08-23 07:39:39 -04:00
Guillaume Lagrange 48a64d3b8a
Add images and csv dataset source to book (#2179) 2024-08-22 15:47:05 -04:00