tracel-ai/burn

Better error messages for incorrect shapes

开放

#199 创建于 2023年3月6日

 (1 条评论) (1 个反应) (0 位负责人)Rust (964 个派生)auto 404
enhancementhelp wanted

仓库指标

星标
 (15,550 个星标)
PR 合并指标
 (平均合并 2天 22小时) (30 天内合并 129 个 PR)

描述

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.

贡献者指南