tracel-ai/burn

Better error messages for incorrect shapes

Aperta

#199 aperta il 6 mar 2023

 (1 commento) (1 reazione) (0 assegnatari)Rust (964 fork)auto 404
enhancementhelp wanted

Metriche repository

Star
 (15.550 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Feature description

The compiler or runtime should explain in a clear language what is wrong and offer a solution, similar what Rust compiler does.

Feature motivation

It's very common to miscalculate/misconfigure NN with incorrect shapes. Sometimes it's part of the process. However, the Burn's error messages are inconsistent across backends and NN modules. Different backends bubble up errors differently. For example, torch tells what size is expected vs given, but ndarray just says wrong size. Additionally, it's very hard to know exactly which line is causing the problem. All these errors will be especially difficult for beginners.

(Optional) Suggest a Solution

Compiler does an excellent job for dimension mismatches. It would be great if compiler could identify the issue early. And if it's possible, then the runtime should check the inputs before passing to the backends, perhaps in debug mode or always.

Guida contributor