GaussianNoise

group GaussianNoise

Unnamed Group

NVCVStatus cvcudaGaussianNoiseSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, NVCVTensorHandle mu, NVCVTensorHandle sigma, int8_t per_channel, unsigned long long seed)
NVCVStatus cvcudaGaussianNoiseScalarSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, float mu, float sigma, int8_t per_channel, unsigned long long seed, int8_t reseed, int8_t clip)

Executes GaussianNoise on a tensor with scalar noise parameters.

This parameter-tensor-free variant passes mu and sigma by value, avoiding device parameter tensors and their host-to-device uploads. Its uint8 conversion and optional clipping match torchvision.transforms.v2.functional.gaussian_noise; float32 output is optionally clamped to [0, 1]. Random samples are generated by CV-CUDA’s cuRAND stream and are not sample-identical to Torch.

Reference: torchvision.transforms.v2.functional.gaussian_noise

Limitations:

Input and output: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: 1, 2, 3, 4 Data Type: [TYPE_U8, TYPE_F32]

Input and output must have identical shape, layout, and data type. mu and sigma use input-value units. For uint8 torchvision-compatible normalized parameters, callers multiply both values by 255 before submission.

Parameters:
  • handle[in] Handle to the operator. Must not be NULL.

  • stream[in] CUDA stream on which to perform the operation.

  • in[in] Input image tensor.

  • out[out] Output image tensor.

  • mu[in] Mean of the Gaussian distribution in input-value units.

  • sigma[in] Non-negative standard deviation in input-value units.

  • per_channel[in] If non-zero, generate independent noise for every channel; otherwise share noise across channels at each pixel.

  • seed[in] Seed for CV-CUDA’s random-number stream.

  • reseed[in] If non-zero, reinitialize the random-number stream from seed before this submission. Otherwise the stream is initialized only on first use and advances between calls.

  • clip[in] If non-zero, clamp output to [0, 255] for uint8 or [0, 1] for float32. If zero, float32 remains unbounded and uint8 wraps modulo 256 after addition.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside its valid range.

  • NVCV_ERROR_INTERNAL – An internal error occurred.

  • NVCV_SUCCESS – Operation was submitted successfully.

NVCVStatus cvcudaGaussianNoiseVarShapeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVImageBatchHandle in, NVCVImageBatchHandle out, NVCVTensorHandle mu, NVCVTensorHandle sigma, int8_t per_channel, unsigned long long seed)

Functions

NVCVStatus cvcudaGaussianNoiseCreate(NVCVOperatorHandle *handle, int maxBatchSize)