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

Function validate_arguments

src/core/NEON/kernels/NERangeKernel.cpp:97–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97Status validate_arguments(const ITensorInfo &output, const float start, const float end, const float step)
98{
99 ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output);
100 const auto *uk = get_implementation(RangeSelectorData{output.data_type()});
101 ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr);
102
103 ARM_COMPUTE_RETURN_ERROR_ON_MSG((start == end), "start of the requested sequence must not be equal to the end");
104 ARM_COMPUTE_RETURN_ERROR_ON_MSG(((start < end) && (step <= 0)), "step must be greater than 0 when start < end");
105 ARM_COMPUTE_RETURN_ERROR_ON_MSG(((start > end) && (step >= 0)), "step must be less than 0 when start > end");
106
107 ARM_COMPUTE_RETURN_ERROR_ON_MSG(!check_value_range(start, output.data_type(), output.quantization_info()),
108 "start value is outside the range of the data type");
109 ARM_COMPUTE_RETURN_ERROR_ON_MSG(!check_value_range(end, output.data_type(), output.quantization_info()),
110 "end value is outside the range of the data type");
111 ARM_COMPUTE_RETURN_ERROR_ON_MSG(!check_value_range(step, output.data_type(), output.quantization_info()),
112 "step value is outside the range of the data type");
113
114 ARM_COMPUTE_RETURN_ERROR_ON_MSG((start == end), "start of the requested sequence must not be equal to the end");
115
116 ARM_COMPUTE_RETURN_ERROR_ON_MSG(output.num_dimensions() != 1, "Output has to be a 1-D tensor");
117 ARM_COMPUTE_RETURN_ERROR_ON_MSG(output.tensor_shape().total_size() < num_of_elements_in_range(start, end, step),
118 "Output tensor size is incorrect");
119
120 return Status{};
121}
122} // namespace
123
124NERangeKernel::NERangeKernel() : _start(0), _end(1), _step(1), _output(nullptr)

Callers 2

configureMethod · 0.70
validateMethod · 0.70

Calls 7

check_value_rangeFunction · 0.85
get_implementationFunction · 0.70
num_of_elements_in_rangeFunction · 0.50
data_typeMethod · 0.45
quantization_infoMethod · 0.45
num_dimensionsMethod · 0.45
total_sizeMethod · 0.45

Tested by

no test coverage detected