aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/TensorOperations.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/TensorOperations.h')
-rw-r--r--tests/validation/TensorOperations.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/validation/TensorOperations.h b/tests/validation/TensorOperations.h
index bf9bceff0a..e2747249b4 100644
--- a/tests/validation/TensorOperations.h
+++ b/tests/validation/TensorOperations.h
@@ -808,6 +808,16 @@ void fixed_point_pixel_wise_multiplication(const Tensor<T> &in1, const Tensor<T>
}
}
+//Table Lookup
+template <typename T, typename T1>
+void table_lookup(const Tensor<T> &in, Tensor<T> &out, std::map<T1, T1> &lut)
+{
+ for(int i = 0; i < in.num_elements(); ++i)
+ {
+ out[i] = static_cast<T>(lut[in[i]]);
+ }
+}
+
// Threshold
template <typename T>
void threshold(const Tensor<T> &in, Tensor<T> &out, uint8_t threshold, uint8_t false_value, uint8_t true_value, ThresholdType type, uint8_t upper)