burn icon indicating copy to clipboard operation
burn copied to clipboard

Implement missing tensor unit tests

Open antimora opened this issue 2 years ago • 6 comments

During a recent PR code review, @agelas found missing of certain unit tests (such as unsqueeze). This ticket is identify the missing tests and implement them.

  1. Identify and document the missing unit tests.
  2. Create and implement these unit tests, then cross-verify the results with a deep learning tool like PyTorch.

If you're not sure how to add a unit test for a tensor, here are the steps:

  1. Include the test under burn-tensor/src/tests/ops.
  2. Insert the module under burn-tensor/src/tests/ops/mod.rs.
  3. Adjust burn-tensor/src/tests/mod.rs to include the new macro call.

For a practical example, take a look at this PR, which implemented the flatten test: https://github.com/burn-rs/burn/pull/260/files.

antimora avatar Jun 05 '23 15:06 antimora

Hi is this something I could work on?

FjodorGit avatar Nov 20 '23 23:11 FjodorGit

Hi is this something I could work on?

Yes, please!

antimora avatar Nov 20 '23 23:11 antimora

I am having a hard time getting the integration tests to run. Running cargo test just does not discover the tests in the burn-tensor/src/tests directory. Do I have to run cargo test with some specific feature flag or something else? I don't quite understand the testgen macro.

FjodorGit avatar Nov 21 '23 22:11 FjodorGit

@FjodorGit, you will need to run tests for each backend. For example, if you need to test with ndarray, you'll need cd to burn-ndarray and run cargo test. The tests are imported. By itself, burn-tensor can't use a backend.

Let us know if you need more help.

antimora avatar Nov 21 '23 22:11 antimora

Oh ok I see. Thank you for your help.

FjodorGit avatar Nov 21 '23 22:11 FjodorGit

I guess it is intentional that the tests don't run for the candle backend?

FjodorGit avatar Nov 22 '23 20:11 FjodorGit

OK. Closing this as it's too generic. We need to identify missing tests and add them as we go.

antimora avatar Mar 29 '24 00:03 antimora