Skip to content
Snippets Groups Projects
Unverified Commit 278226b5 authored by Yaman Umuroglu's avatar Yaman Umuroglu Committed by GitHub
Browse files

[Test] small comment and changes in multithreshold

parent 5b1d3810
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ def compare(x, y): ...@@ -40,7 +40,7 @@ def compare(x, y):
else: else:
return 0.0 return 0.0
# naive implementation of thresholding for performance comparison
def multithreshold_elementwise(v, thresholds, out_scale=None, out_bias=None): def multithreshold_elementwise(v, thresholds, out_scale=None, out_bias=None):
"""Given a set of threshold values t={t_0, t_1 ... t_n} the successive """Given a set of threshold values t={t_0, t_1 ... t_n} the successive
thresholding maps any real number x to an integer in the interval [0, n], thresholding maps any real number x to an integer in the interval [0, n],
...@@ -96,7 +96,7 @@ def multithreshold_elementwise(v, thresholds, out_scale=None, out_bias=None): ...@@ -96,7 +96,7 @@ def multithreshold_elementwise(v, thresholds, out_scale=None, out_bias=None):
return out_scale * ret.reshape(v.shape) + out_bias return out_scale * ret.reshape(v.shape) + out_bias
def test_execute_multi_thresholding(): def test_multithreshold():
inputs = np.ndarray( inputs = np.ndarray(
shape=(6, 3, 2, 2), shape=(6, 3, 2, 2),
...@@ -315,8 +315,8 @@ def test_execute_multi_thresholding(): ...@@ -315,8 +315,8 @@ def test_execute_multi_thresholding():
if __name__ == "__main__": if __name__ == "__main__":
vector_runtime, non_vector_runtime = test_execute_multi_thresholding() vector_runtime, non_vector_runtime = test_multithreshold()
print("Runtime non vector: ", non_vector_runtime, "s") print("Runtime non-vectorized: ", non_vector_runtime, "s")
print("Runtime vectorized: ", vector_runtime, "s") print("Runtime vectorized: ", vector_runtime, "s")
print("Speed-up: ", non_vector_runtime / vector_runtime) print("Speed-up: ", non_vector_runtime / vector_runtime)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment