Skip to content

Commit 52a1dcb

Browse files
committed
More tests
Signed-off-by: Janusz Lisiecki <[email protected]>
1 parent d180ad9 commit 52a1dcb

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

dali/test/python/operator_2/test_random_resized_crop.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def pixel(x, y):
3939
assert close(y0, y1), "y0 = {} != y1 = {}".format(y0, y1)
4040
assert close(y2, y3), "y2 = {} != y3 = {}".format(y2, y3)
4141
assert close(f0, f1) and close(f0, f2) and close(f0, f3)
42-
return x0, y0, x3, y3, int(np.round(f0))
42+
return np.int32(x0), np.int32(y0), np.int32(x3), np.int32(y3), np.int32(np.round(f0))
4343

4444

4545
def check_frame(
@@ -60,21 +60,10 @@ def check_frame(
6060
xeps = np.ceil(2 + 2 * w / out_w)
6161
yeps = np.ceil(2 + 2 * h / out_h)
6262
if frame_index == 0:
63-
x0_u32 = np.uint32(x0)
64-
x1_u32 = np.uint32(x1)
65-
y0_u32 = np.uint32(y0)
66-
y1_u32 = np.uint32(y1)
67-
w_u32 = np.uint32(w)
68-
h_u32 = np.uint32(h)
69-
value_range_u32 = np.uint32(value_range)
70-
71-
roi_w = (x1_u32 - x0_u32) * w_u32 / value_range_u32
72-
roi_h = (y1_u32 - y0_u32) * h_u32 / value_range_u32
73-
74-
roi_w_max = min(roi_w + xeps, w)
75-
roi_w_min = max(roi_w - xeps, 1)
76-
roi_h_max = min(roi_h + yeps, h)
77-
roi_h_min = max(roi_h - xeps, 1)
63+
roi_w_max = min((x1 - x0) * w / value_range + xeps, w)
64+
roi_w_min = max((x1 - x0) * w / value_range - xeps, 1)
65+
roi_h_max = min((y1 - y0) * h / value_range + yeps, h)
66+
roi_h_min = max((y1 - y0) * h / value_range - xeps, 1)
7867
ratio_min = roi_w_min / roi_h_max
7968
ratio_max = roi_w_max / roi_h_min
8069
area_min = roi_w_min * roi_h_min / (w * h)

qa/TL0_python-self-test-core/test_body.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
#!/bin/bash -e
22

3+
test_different_numpy_versions() {
4+
# Testing with older numpy version as we mostly run tests with numpy 2.x
5+
# to check that we are still compatible with it
6+
install_pip_pkg "pip install --upgrade numpy<2 -f /pip-packages"
7+
for test_script in $(ls test_pipeline.py \
8+
test_pipeline_decorator.py \
9+
test_pipeline_segmentation.py); do
10+
${python_invoke_test} ${test_script}
11+
done
12+
}
13+
314
test_py_with_framework() {
415
# Note that we do not filter '!numba' below as it is installed as dependency
516
for test_script in $(ls test_pipeline.py \

qa/TL0_python-self-test-core/test_nofw.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ source test_body.sh
99

1010
test_body() {
1111
test_no_fw
12+
test_different_numpy_versions
1213
}
1314

1415
pushd ../..

0 commit comments

Comments
 (0)