Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PReLU Support for a single-value tensor #14933

Closed
mouliraj-mcw opened this issue Nov 11, 2024 · 0 comments · Fixed by #15261
Closed

Add PReLU Support for a single-value tensor #14933

mouliraj-mcw opened this issue Nov 11, 2024 · 0 comments · Fixed by #15261
Assignees

Comments

@mouliraj-mcw
Copy link
Contributor

mouliraj-mcw commented Nov 11, 2024

In Torch PReLU, the second input tensor i.e weight can be passed as:

  • either a 0 dim tensor with weight value ,
  • 1d tensor with a single element or
  • a tensor with a size equal to the number of input channels (default is 1).

Currently, our implementation only supports cases where it matches the number of channels or weight passed as scalar.

We need support for the case where weight tensor is 1D list/array with length=1

@KalaivaniMCW KalaivaniMCW self-assigned this Nov 19, 2024
mouliraj-mcw added a commit that referenced this issue Nov 21, 2024
### Ticket
Link to Github Issue #8544 

### Problem description
Currently PReLU is aliased to LeakyRelu which is not correct. It needs
to be properly implemented in the eltwise operation.

### What's changed
- Update the prelu implementation In composite structure.
- It also support sfpu(Added in this PR) for certain cases which will
handled soon in #14933 .

### Additional Information
In Torch PReLU, the second input tensor can only have two valid shapes:
either a tensor with a single value (1) or a tensor with a size equal to
the number of input channels (default is 1). Currently, This
implementation only supports cases where it matches the number of
channels. Support for a single-value tensor requires additional handling
at the low-level kernel.

### Checklist
- [ ] [All Post commit CI
](https://github.com/tenstorrent/tt-metal/actions/runs/11796920085)
@KalaivaniMCW KalaivaniMCW linked a pull request Nov 23, 2024 that will close this issue
5 tasks
KalaivaniMCW added a commit that referenced this issue Nov 23, 2024
### Ticket
Link to Github Issue #14933

### Problem description
Need Support PRelu to accept single element weight array as input

### What's changed
Added support for the same

### Checklist
- [x] Post commit CI passes
https://github.com/tenstorrent/tt-metal/actions/runs/11960853362
https://github.com/tenstorrent/tt-metal/actions/runs/11987294776
- [ ] Blackhole Post commit (if applicable)
- [ ] Model regression CI testing passes (if applicable)
- [ ] Device performance regression CI testing passes (if applicable)
- [x] New/Existing tests provide coverage for changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants