INT4 compression (#4912)

* INT4 compression

* packing tests

* (U)INT4 IR Reader enabling

* Cast test header added

* Fix graph.clean_up

* Review discussions addressed: comments clarification, variable naming, fuller test coverage
This commit is contained in:
Evgenya Stepyreva authored and GitHub committed 2021-03-26 01:06:44 +03:00
1 parent 8b4837ea62
commit 2e75aafbe2
10 files changed
+307 -55

No files matched your search

@@ -310,6 +310,8 @@ class IREngine(object):
'I8': (1, np.int8),
'U8': (1, np.uint8),
'U1': (1, np.uint8),
'U4': (1, np.uint8),
'I4': (1, np.uint8),
'BOOL': (1, np.bool),
'BIN': (1, np.uint8),
}
@@ -169,7 +169,14 @@ def propagate_const_values(op: Node):
op['shape'] = out_data_node.shape
# Reshape data node value for correct shape
op['value'] = np.reshape(value, op.shape)
if op['element_type'] in ['u4', 'i4']:
# Packed data types are custom from numpy perspective.
# Shape from the IR is incompatible with numpy value we store.
op['value'] = value
op['force_type'] = op['element_type'].upper()
op['force_shape'] = op.shape.copy()
else:
op['value'] = np.reshape(value, op.shape)
def groupconv_to_conv(op: Node):