Skip to content

[Bug][Relax] Inconsistent IRs will be got when Load IRs with R.nn.pad operator #17483

@jikechao

Description

@jikechao

Actual behavior

error: pad() got multiple values for argument 'pad_width'
 --> <str>:8:55
   |  
 8 |          gv: R.Tensor((2, 130, 30), dtype="float32") = R.nn.pad(x, R.const(0, "int32"), pad_width=[0, 0, 1, 1, 1, 1], pad_mode="constant")
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Steps to reproduce

import tvm
from tvm import relax
from tvm.script import relax as R

@tvm.script.ir_module
class Module:
    @R.function
    def main(x: R.Tensor((2, 128, 28), "float32")) -> R.Tensor((2, 130, 30), "float32"):
        gv: R.Tensor((2, 130, 30), "float32") = R.nn.pad(x, (0, 0, 1, 1, 1, 1))
        return gv

m = Module
m.show()
m_str = m.script()
m2 = tvm.script.from_source(m_str)
m2.show()  # crash

@junrushao @tqchen @Lunderberg

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions