Skip to content

Commit 0cf9806

Browse files
author
klassen9
committed
Disallow use of axes and ROI for Resize
1 parent e116fc2 commit 0cf9806

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/qonnx/transformation/change_3d_tensors_to_4d.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ def apply(self, model):
196196
scales = np.append(scales, np.asarray(1.0, dtype=np.float32))
197197
model.set_initializer(n.input[1], scales)
198198
elif node_op_type == "Resize":
199+
assert ("axes" not in [x.name for x in n.attribute]), (
200+
"%s: Axes attribute is not supported." % n.name
201+
)
202+
assert (not (len(n.input) in (3, 4) and model.get_initializer(n.input[1]) is not None)), (
203+
"%s: ROI input is not supported." % n.name
204+
)
199205
if len(n.input) == 2:
200206
# Resize version 10
201207
scales = model.get_initializer(n.input[1])
@@ -223,13 +229,6 @@ def apply(self, model):
223229
sizes = model.get_initializer(n.input[3])
224230
sizes = np.append(sizes, np.asarray(1.0, dtype=np.int64))
225231
model.set_initializer(n.input[3], sizes)
226-
if len(n.input) in (3, 4) and model.get_initializer(n.input[1]) is not None:
227-
# ROI handling
228-
roi = model.get_initializer(n.input[1])
229-
d_type = roi.dtype #float64, float32 or float16
230-
# ROI for 3d tensor: [start1, start2, start3, end1, end2, end3]
231-
roi = np.concatenate((roi[0:3], np.asarray(1.0, dtype=d_type), roi[3:6], np.asarray(1.0, dtype=d_type)), axis=None)
232-
model.set_initializer(n.input[1], roi)
233232
input_shape.append(1)
234233

235234
# Change format of each input/value_info/output tensor

0 commit comments

Comments
 (0)