Skip to content

Conversation

@Deivanayaki-S
Copy link
Contributor

This PR adds support for the Softplus operation in both the Exported Program and FX graph Relax frontend pipeline.

@Deivanayaki-S Deivanayaki-S changed the title [Relax][PyTorch] Add Softplus Op Support for Exported Program and FX graph [Relax][PyTorch] Add Softplus Op Support for Exported Program and FX graph frontend Apr 3, 2025
@Deivanayaki-S Deivanayaki-S changed the title [Relax][PyTorch] Add Softplus Op Support for Exported Program and FX graph frontend [Relax][PyTorch] Add Softplus Op Support for Exported Program and FX graph Apr 3, 2025
@Deivanayaki-S Deivanayaki-S marked this pull request as ready for review April 4, 2025 13:05
Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. As you added a new relax op, please also expose it in tvm script frontend. To be sepefic: at file https://github.com/apache/tvm/blob/main/python/tvm/script/ir_builder/relax/ir.py.

Also please add unit tests:

  1. op tests, in tests/python/relax/test_op_nn.py
  2. tvm sciprt tests, in tests/python/relax/test_frontend_nn_op.py:394

@Deivanayaki-S
Copy link
Contributor Author

I've added the unit tests in test_op_nn.py and test_frontend_nn_op.py as requested. However, regarding exposing the op in the TVMScript frontend (in tvm/script/ir_builder/relax/ir.py), I noticed that only core ops are defined there, and nn ops don't seem to be exposed directly in that file.
Could you please clarify whether nn ops like softplus should also be registered there?

@Hzfengsy
Copy link
Member

Hzfengsy commented Apr 9, 2025

Could you please clarify whether nn ops like softplus should also be registered there?

Thanks for pointing it out. I apologize that nn ops do not need to be explicitly exposed in that file, as the nn namespace is exposed as a whole unit.

Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hzfengsy Hzfengsy merged commit bf61216 into apache:main Apr 9, 2025
10 checks passed
ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
…graph (apache#17806)

* add softplus op into exported program and fx graph frontend

* fixing trailing whitespace issue

* fixing lint issues

* fix lint issue on docs

* modify description to avoid cpplints issue

* update softplus function with threshold attr

* remove trailing spaces in softplus func

* fix lint issues in legalize func

* fixing cpp lints issue

* test script for both exported and fx graph

* trim trailing spaces iin test script

* fix lint issues in test script

* unit test script is added in test frontend op files

* fixing lint issues in test_op_nn file

* fixing attribute error in test script

* fixing lint issues in test script functions

* adding softplus wrapper function in op file

---------

Co-authored-by: deivanayakisankaralingam <deiva@Deivanayaki>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants