Skip to content
Snippets Groups Projects
Commit 05f11518 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Test] add 1D upsample testcase, currently fails

parent 5dd85ebc
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,7 @@ class PyTorchTestModel(nn.Module): ...@@ -117,7 +117,7 @@ class PyTorchTestModel(nn.Module):
# param datatype # param datatype
@pytest.mark.parametrize("dt", [DataType["INT8"]]) @pytest.mark.parametrize("dt", [DataType["INT8"]])
# Width/height of square input feature map # spatial dim input feature map
@pytest.mark.parametrize("IFMDim", [3, 5]) @pytest.mark.parametrize("IFMDim", [3, 5])
# upscaling factor # upscaling factor
@pytest.mark.parametrize("scale", [2, 3]) @pytest.mark.parametrize("scale", [2, 3])
...@@ -125,14 +125,19 @@ class PyTorchTestModel(nn.Module): ...@@ -125,14 +125,19 @@ class PyTorchTestModel(nn.Module):
@pytest.mark.parametrize("NumChannels", [4]) @pytest.mark.parametrize("NumChannels", [4])
# execution mode # execution mode
@pytest.mark.parametrize("exec_mode", ["cppsim", "rtlsim"]) @pytest.mark.parametrize("exec_mode", ["cppsim", "rtlsim"])
# whether to use 1D or 2D square testcases
@pytest.mark.parametrize("is_1d", [False, True])
@pytest.mark.fpgadataflow @pytest.mark.fpgadataflow
@pytest.mark.vivado @pytest.mark.vivado
@pytest.mark.slow @pytest.mark.slow
def test_fpgadataflow_upsampler(dt, IFMDim, scale, NumChannels, exec_mode): def test_fpgadataflow_upsampler(dt, IFMDim, scale, NumChannels, exec_mode, is_1d):
atol = 1e-3 atol = 1e-3
# Create the test model and inputs for it # Create the test model and inputs for it
torch_model = PyTorchTestModel(upscale_factor=scale) torch_model = PyTorchTestModel(upscale_factor=scale)
input_shape = (1, NumChannels, IFMDim, IFMDim) if is_1d:
input_shape = (1, NumChannels, IFMDim, 1)
else:
input_shape = (1, NumChannels, IFMDim, IFMDim)
test_in = torch.arange(0, np.prod(np.asarray(input_shape))) test_in = torch.arange(0, np.prod(np.asarray(input_shape)))
# Limit the input to values valid for the given datatype # Limit the input to values valid for the given datatype
test_in %= dt.max() - dt.min() + 1 test_in %= dt.max() - dt.min() + 1
......
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