holoscan::ops::TensorPreprocessorOp
holoscan::ops::TensorPreprocessorOp
GPU-native resize + optional normalize + optional HWC->CHW transpose.
All work runs on the CUDA device against the Holoscan stream, using NVIDIA Performance Primitives (NPP): nppiResize_8u_C3R_Ctx for bilinear resize, nppiConvert_8u32f_C3R_Ctx for the u8->f32 dtype cast, nppiMulC_32f_C3IR_Ctx / nppiSubC_32f_C3IR_Ctx / nppiDivC_32f_C3IR_Ctx for the x = (x/255 - mean) / ``std normalization, and nppiCopy_8u_C3P3R_Ctx / nppiCopy_32f_C3P3R_Ctx for the HWC->CHW plane split. Only the device memory kind (kCudaDevice / kCudaManaged) is supported for both input and output; requesting a host-side output raises an error.
Inherits from: holoscan::Operator< TensorPreprocessorOpParams > (public)
Constructors
TensorPreprocessorOp
Default
Overload 2
Copy (deleted)
Destructor
~TensorPreprocessorOp
Assignment operators
operator=
Methods
setup
Declare stable ports and other cold metadata by reference.
Repeated calls receive fresh specs and must describe the same deterministic contract.
Parameters
Fresh declaration pass owned by the compiler or private conformance fixture.
start
Enter steady-state execution after admitted startup barriers.
An override must remain public and keep the exact void start() signature. Graph authoring lowers it into the single required LifecycleStage::kStart checkpoint; an Operator cannot also register an advanced callback for that stage. Cold preparation belongs to explicit lifecycle stages added by their owning component. For a typed session-owned Operator, params() exposes the exact parameter generation selected for this phase.
stop
Leave steady-state execution before resource release.
An override must remain public and keep the exact void stop() signature. Graph authoring lowers it into the single required LifecycleStage::kStop checkpoint; an Operator cannot also register an advanced callback for that stage. For a typed session-owned Operator, params() exposes the exact parameter generation selected for this phase, including the restored old-published view during rollback.
compute
Process one frozen activation candidate.
The callback is invoked at most once for one activation tag. It must not wait for or recursively trigger another activation.
Returns: Success after Operator work completes, or a typed failure for Runtime policy.
Parameters
Borrowed callback-lifetime runtime services and activation evidence.
contract
Return this Operator type’s complete cold temporal contract.
Runtime does not retain this authoring object’s address. Compilation calls this operation while replaying an owning Operator factory and freezes the validated descriptor into pointer-free plan records.
Returns: Fresh deep-owning descriptor; an empty value requests the inputful compile-time OnAnyInput default and is invalid for a zero-input Operator.
input_port
The single dynamically-named Input<Tensor> port (declared when params()``.input_kind == "tensor").
Non-null even when the ImageT port is active, so downstream graph.add_flow() calls that reach through input_port() produce a clear declared-nowhere diagnostic instead of a null-dereference.
image_input_port
The single dynamically-named Input<schema::ImageT> port (declared when params()``.input_kind == "image").
output_port
The single dynamically-named output port (declared in setup() as params()``.output_port_name).
params
Return this Operator instance’s currently stored parameter aggregate.
Before session binding, the aggregate is the authoring default. During a legacy start() or stop() callback on a session-owned instance, it is the exact generation selected for that lifecycle phase. Advanced lifecycle callbacks must use LifecycleContext and compute callbacks must use ExecutionContext::params<ParamsT>() for their pinned views. Runtime may replace the stored aggregate between quiesced lifecycle callbacks, so callers must not retain the returned reference across callback boundaries. This operation does not allocate or synchronize.
Returns: Process-static shared NoParams value, or a stable reference to this instance’s aggregate.
host_metadata
Return cold compiler-visible callback-host metadata.
Returns: Native hosting without a serialization constraint by default.