Replies: 1 comment
-
Well first of all, the behavior is triggered in the test because we specifically test for that panic condition. So if you remove the check but leave the test, it will fail. And because we don't have an explicit check anymore for the content of the source tensor you want to convert to its one-hot representation, the failure happens further down the line. The checks are valid, and there for a reason. But pretty much none of them operate on the content/values of the tensor, instead on some other "static" conditions like the shape, rank, etc. My comment was specifically directed at the value check. Performing that check in the op has some performance impact, so there is a valid point to be made about its removal. As you can see, the program will panic anyway if you have invalid values, it's just that the panic message is not as clear 😅 And regarding the changes linked, I would not remove the entire check. We can keep the check on the number of classes, but remove the value check. |
Beta Was this translation helpful? Give feedback.
-
Purpose
Relating to #2613 (comment), so let me mention @laggui
I would like to check the role of
check!
macro and related check functions incrates/burn-tensor/src/tensor/api/check.rs
I suppose it is necessary to prevent poisoned lock issues instead of native errors.
If my guess is right, should I keep the one hot tensor check function?
Background
I tried to remove the parts of one_hot_tensor as below and run the command
cargo xtask validate
orcargo test -p burn-router --lib
.Then, I come across poisoned lock error as below.
The same errors can be triggered when I remove other check functions like
pub fn scatter(self, dim: usize, indices: Tensor<B, D, Int>, values: Self) -> Self {...}
. Therefore, I do not think it is only limited to one_hot function.My guess is these kinds of checks are necessary here, so I should keep checks in one hot as it is.
Reproduction
Use and clone this repository and run
cargo test -p burn-router --lib
.main...tiruka:burn:feature/delete-old-one-hot-checker
I may not include some necessary information, in that case, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions