Class DataProcessor

class DataProcessor

Data Processor class that processes one operations per tensor. Currently supports CPU based single operation.

Public Functions

inline DataProcessor()

Default Constructor.

InferStatus initialize(const MultiMappings &process_operations)

Checks the validity of supported operations.

Parameters

process_operations – Map where tensor name is the key, and operations to perform on the tensor as vector of strings. Each value in the vector of strings is the supported operation.

Returns

InferStatus with appropriate code and message

InferStatus process_operation(const std::string &operation, const std::vector<int> &in_dims, const std::vector<float> &in_data, std::vector<int64_t> &out_dims, std::vector<float> &out_data)

Executes an operation via function callback. (Currently CPU based)

Parameters
  • operation – Operation to perform. Refer to user docs for a list of supported operations

  • in_dims – Dimension of the input tensor

  • in_data – Input data buffer

  • out_dims – Dimension of the output tensor

  • out_data – Output data buffer

Returns

InferStatus with appropriate code and message

void compute_max_per_channel_cpu(const std::vector<int> &in_dims, const std::vector<float> &in_data, std::vector<int64_t> &out_dims, std::vector<float> &out_data)

Computes max per channel in input data and scales it to [0, 1]. (CPU based)

Parameters
  • operation – Operation to perform. Refer to user docs for a list of supported operations

  • in_dims – Dimension of the input tensor

  • in_data – Input data buffer

  • out_dims – Dimension of the output tensor

  • out_data – Output data buffer

void print_results(const std::vector<int> &in_dims, const std::vector<float> &in_data)

Print data in the input buffer. Ideally to be used by classification models.

Parameters
  • in_dims – Dimension of the input tensor

  • in_data – Input data buffer

© Copyright 2022, NVIDIA. Last updated on Jun 28, 2023.