Skip to content

[BUG] Some method not support float16 #260

@631068264

Description

@631068264

Describe the bug
Get many error when I use float16 get many error and I don't know how to solve . float16 is a common precision why not support .

Steps/Code to reproduce bug
Follow this guide
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports to craft a
minimal bug report. This helps us reproduce the issue you're having and resolve
the issue more quickly.

Get same error when I use float16 as dtype as params of cvcuda.normalize
#142

        mean_cp = np_to_cuda_buffer(mean_params, dtype=np.float16).reshape(1, 1, 3)
        std_cp = np_to_cuda_buffer(std_params, dtype=np.float16).reshape(1, 1, 3)
        mean_tensor = cvcuda.as_tensor(mean_cp, nvcv.TensorLayout.HWC)
        std_tensor = cvcuda.as_tensor(std_cp, nvcv.TensorLayout.HWC)
        # Convert image to numpy array and scale to [0,1]
        cv_tensor = cvcuda.convertto(cv_tensor, dtype, scale=1.0 / 255.0, stream=cls.stream)
        # Normalize using mean and std (broadcast across height and width)
        cv_tensor = cvcuda.normalize(cv_tensor,
                                     base=mean_tensor,
                                     scale=std_tensor,
                                     flags=cvcuda.NormalizeFlags.SCALE_IS_STDDEV, stream=cls.stream)

get error

RuntimeError: DLPack buffer's data type must have at most 4 lanes

When use np.float32 is ok

        cv_tensor = cvcuda.convertto(cv_tensor, np.float16, scale=1.0 / 255.0, stream=cls.stream)

get error

ValueError: Casting nvcv::DataType from PyObject failed: Unable to cast Python instance of type <class 'type'> to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details)

Expected behavior
A clear and concise description of what you expected to happen.

Environment overview (please complete the following information)

  • Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)]
  • Method of cuDF install: [Docker, pip, or from source]
    • If method of install is [Docker], provide docker pull & docker run commands used
      pip install cvcuda-cu12==0.15.0
      Environment details
      Please run and paste the output of the cvcuda/print_env.sh script here, to gather any other relevant environment details

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected (software, install, documentation)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions