Skip to content

Incorrect Type Hint for jt.Var.shape #656

@PREPONDERANCE

Description

@PREPONDERANCE

Describe the bug

A clear and concise description of what the bug is. 使用中文也可以。

The type hint for x.shape indicates it's a method (x is a jt.Var). However, in fact, it's an attribute as described by inspect.getmembers(jt.Var):

shape <attribute 'shape' of 'jittor_core.Var' objects> <class 'getset_descriptor'>

This particular mismatch may bring about additional mind burden for new comers even though anyone from a torch background will simply write the code.

Full Log

Provide a full log of Jittor execution, Jittor will log environment information which help us to locate your bugs. Provide a screenshot is also acceptable.

Image

Minimal Reproduce

Reproduce this error with a file or several lines of code.
If it is not possible, leave it blank.

Simply create a jt.Var and call its .shape API. Hover over and inspect it.

Expected behavior

A clear and concise description of what you expected to happen.

The expected type hint for x.shape will be something similar to that of torch, an attribute rather than a method.

If you are submitting an issue for the first time, please refer to our guideline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions