Skip to content

Support clamp() with tensor min and max #2793

@zuoxingdong

Description

@zuoxingdong

It might be useful to extend the current clamp() function, where the min and max can be tensor.

e.g. To clip the value for a [5, 3]-tensor, we could define min and max for each element, or each row/column.

Finally, it might be good to rename it to clip to be consistent with numpy.clip

cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @mruberry @rgommers @heitorschueroff

Metadata

Metadata

Assignees

Labels

function requestA request for a new function or the addition of new arguments/modes to an existing function.good first issuehigh prioritymodule: numpyRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions