From 5f1c3a316ae98eaf42244dba13765a30f6099581 Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <maltanar@gmail.com> Date: Tue, 18 Aug 2020 11:32:40 +0200 Subject: [PATCH] [DataType] add finer-granularity integer types and (u)int64 --- src/finn/core/datatype.py | 52 +++++++++++++++++++ .../test_convert_to_hls_layers_fc.py | 1 + 2 files changed, 53 insertions(+) diff --git a/src/finn/core/datatype.py b/src/finn/core/datatype.py index 222d11a88..df895a1ad 100644 --- a/src/finn/core/datatype.py +++ b/src/finn/core/datatype.py @@ -50,17 +50,69 @@ class DataType(Enum): UINT2 = auto() UINT3 = auto() UINT4 = auto() + UINT5 = auto() + UINT6 = auto() + UINT7 = auto() UINT8 = auto() + UINT9 = auto() + UINT10 = auto() + UINT11 = auto() + UINT12 = auto() + UINT13 = auto() + UINT14 = auto() + UINT15 = auto() UINT16 = auto() + UINT17 = auto() + UINT18 = auto() + UINT19 = auto() + UINT20 = auto() + UINT21 = auto() + UINT22 = auto() + UINT23 = auto() + UINT24 = auto() + UINT25 = auto() + UINT26 = auto() + UINT27 = auto() + UINT28 = auto() + UINT29 = auto() + UINT30 = auto() + UINT31 = auto() UINT32 = auto() + UINT64 = auto() BIPOLAR = auto() TERNARY = auto() INT2 = auto() INT3 = auto() INT4 = auto() + INT5 = auto() + INT6 = auto() + INT7 = auto() INT8 = auto() + INT9 = auto() + INT10 = auto() + INT11 = auto() + INT12 = auto() + INT13 = auto() + INT14 = auto() + INT15 = auto() INT16 = auto() + INT17 = auto() + INT18 = auto() + INT19 = auto() + INT20 = auto() + INT21 = auto() + INT22 = auto() + INT23 = auto() + INT24 = auto() + INT25 = auto() + INT26 = auto() + INT27 = auto() + INT28 = auto() + INT29 = auto() + INT30 = auto() + INT31 = auto() INT32 = auto() + INT64 = auto() FLOAT32 = auto() def bitwidth(self): diff --git a/tests/fpgadataflow/test_convert_to_hls_layers_fc.py b/tests/fpgadataflow/test_convert_to_hls_layers_fc.py index d77065ad9..30d5ae64c 100644 --- a/tests/fpgadataflow/test_convert_to_hls_layers_fc.py +++ b/tests/fpgadataflow/test_convert_to_hls_layers_fc.py @@ -123,6 +123,7 @@ def test_convert_to_hls_layers_tfc_w1a1(): # do forward pass in PyTorch/Brevitas expected = tfc.forward(input_tensor).detach().numpy() assert np.isclose(produced, expected, atol=1e-3).all() + os.remove(export_onnx_path) @pytest.mark.vivado -- GitLab