Skip to content

TORCH backend for RandHistogramShift transform #4565

Description

@dyollb

Is your feature request related to a problem? Please describe.
Currently the only transform in our augmentation pipeline that doesn't have a TORCH backend is the RandHistogramShiftd.
I have not profiled the speedup and GPU memory for the augmentation transforms, but I guess if we could do most of it on the GPU it should improve performance.

Describe the solution you'd like
Implement TORCH backend for RandHistogramShift.

Describe alternatives (solution) you've considered
I would propose to

  • not change RandHistogramShift.randomize, i.e. control points remain np.ndarray
  • cast the control points to the input NdarrayOrTensor type
  • implement a function with the functionality/API of np.interp (used in __call__) that supports NdarrayOrTensor

An example implementation for np.interp-like function using torch.Tensor is mentioned here: pytorch/pytorch#50334

If you agree to this strategy I will submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions