tracel-ai/burn

Better error messages for incorrect shapes

Open

#199 opened on Mar 6, 2023

View on GitHub
 (1 comment) (1 reaction) (0 assignees)Rust (964 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (15,550 stars)
PR merge metrics
 (PR metrics pending)

Description

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.

Contributor guide