MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / validate_arguments

Function validate_arguments

src/core/CPP/kernels/CPPTopKVKernel.cpp:44–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44Status validate_arguments(const ITensorInfo *predictions,
45 const ITensorInfo *targets,
46 ITensorInfo *output,
47 const unsigned int k)
48{
49 ARM_COMPUTE_UNUSED(k);
50 ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(predictions, targets, output);
51 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(predictions, targets);
52 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(predictions, ITensorInfo::one_channel, DataType::QASYMM8,
53 DataType::QASYMM8_SIGNED, DataType::S32, DataType::F16,
54 DataType::F32);
55 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(targets, ITensorInfo::one_channel, DataType::U32);
56
57 ARM_COMPUTE_RETURN_ERROR_ON(predictions->num_dimensions() > 2);
58 ARM_COMPUTE_RETURN_ERROR_ON(targets->num_dimensions() > 1);
59 ARM_COMPUTE_RETURN_ERROR_ON(targets->dimension(0) != predictions->dimension(1));
60 // Validate configured output
61 if (output->total_size() != 0)
62 {
63 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
64 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(output->tensor_shape(), targets->tensor_shape());
65 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, ITensorInfo::one_channel, DataType::U8);
66 }
67 else
68 {
69 const auto output_info = TensorInfo(targets->tensor_shape(), ITensorInfo::one_channel, DataType::U8);
70 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output_info);
71 }
72
73 return Status{};
74}
75} // namespace
76
77template <typename T>

Callers 2

configureMethod · 0.70
validateMethod · 0.70

Calls 4

TensorInfoClass · 0.50
num_dimensionsMethod · 0.45
dimensionMethod · 0.45
total_sizeMethod · 0.45

Tested by

no test coverage detected