MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Clamp

Function Clamp

tensorflow/lite/kernels/cpu_backend_gemm_test.cc:123–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template <typename Scalar>
123void Clamp(const std::vector<Scalar>& src, Scalar clamp_min, Scalar clamp_max,
124 std::vector<Scalar>* dst) {
125 dst->resize(src.size());
126 for (int i = 0; i < src.size(); i++) {
127 (*dst)[i] = std::max(std::min(src[i], clamp_max), clamp_min);
128 }
129}
130
131template <typename AccumScalar, typename DstScalar,
132 QuantizationFlavor quantization_flavor>

Calls 4

maxFunction · 0.50
minFunction · 0.50
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected