Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.
This repository was archived by the owner on May 22, 2023. It is now read-only.

[Bug] [Shape & Type] No error for incompatible shape and type between LHS and RHS of binding #232

Open
@psrivas2

Description

@psrivas2

I expected the following module to throw compilation error, but there doesn't seem to be any static shape or type checking between LHS and RHS of a binding.

def test_check_binding():
    @tvm.script.ir_module
    class InputMod:
        @R.function
        def f(x: Tensor((2, 3), "float32")):
            with R.dataflow():
                # The var shape annotation has incorrect ndim, dtype and shape. But no error is thrown.
                z: Tensor((3, 2, 5), "int64") = x 
                R.output(z)
            return z

    InputMod.show()
    print(InputMod["f"].body.blocks[0].bindings[-1].var.checked_type) # Tensor[ndim=3, "int64"]
    print(InputMod["f"].body.blocks[0].bindings[-1].value.checked_type) # Tensor[ndim=2, "float32"]
    print("Well Formed: ", "True" if relax.analysis.well_formed(InputMod) == 1 else "False") # Well Formed: True

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions