Merge branch 'refactorone' of chef.heaplab.deib.polimi.it:nnicolosi/Raptor into refactorone
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -262,7 +262,7 @@ def conv_grouped_many_groups():
|
||||
X = helper.make_tensor_value_info("X", TensorProto.FLOAT, [1, 1024, 2, 2])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [1, 1024, 2, 2])
|
||||
W = numpy_helper.from_array(
|
||||
np.random.default_rng(77).uniform(-1, 1, (1024, 64, 1, 1)).astype(np.float32), name="W")
|
||||
np.random.default_rng(77).uniform(-1, 1, (1024, 16, 1, 1)).astype(np.float32), name="W")
|
||||
node = helper.make_node("Conv", ["X", "W"], ["Y"],
|
||||
kernel_shape=[1, 1], strides=[1, 1], pads=[0, 0, 0, 0], group=64)
|
||||
graph = helper.make_graph([node], "conv_grouped_many_groups", [X], [Y], initializer=[W])
|
||||
@@ -779,28 +779,6 @@ def matmul_matrix_vector():
|
||||
save_model(model, "matmul/matrix_vector", "matmul_matrix_vector.onnx")
|
||||
|
||||
|
||||
def matmul_vector_vector_dot():
|
||||
"""Vector-vector MatMul producing a scalar output."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [1024])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [])
|
||||
B = numpy_helper.from_array(np.random.default_rng(97).uniform(-1, 1, (1024,)).astype(np.float32), name="B")
|
||||
node = helper.make_node("MatMul", ["A", "B"], ["Y"])
|
||||
graph = helper.make_graph([node], "matmul_vector_vector_dot", [A], [Y], initializer=[B])
|
||||
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
|
||||
save_model(model, "matmul/vector_vector_dot", "matmul_vector_vector_dot.onnx")
|
||||
|
||||
|
||||
def matmul_batched_4d_broadcast():
|
||||
"""Batched 4D MatMul with broadcast across leading dimensions."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [2, 1, 3, 4])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [2, 5, 3, 6])
|
||||
B = numpy_helper.from_array(np.random.default_rng(98).uniform(-1, 1, (1, 5, 4, 6)).astype(np.float32), name="B")
|
||||
node = helper.make_node("MatMul", ["A", "B"], ["Y"])
|
||||
graph = helper.make_graph([node], "matmul_batched_4d_broadcast", [A], [Y], initializer=[B])
|
||||
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
|
||||
save_model(model, "matmul/batched_4d_broadcast", "matmul_batched_4d_broadcast.onnx")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pooling tests
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -1560,17 +1538,6 @@ def add_channel_broadcast_1024():
|
||||
save_model(model, "add/channel_broadcast_1024", "add_channel_broadcast_1024.onnx")
|
||||
|
||||
|
||||
def add_scalar_runtime():
|
||||
"""Elementwise Add with a runtime scalar RHS."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
B = helper.make_tensor_value_info("B", TensorProto.FLOAT, [1, 1, 1, 1])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
node = helper.make_node("Add", ["A", "B"], ["Y"])
|
||||
graph = helper.make_graph([node], "add_scalar_runtime", [A, B], [Y])
|
||||
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
|
||||
save_model(model, "add/scalar_runtime", "add_scalar_runtime.onnx")
|
||||
|
||||
|
||||
def add_leading_dimension_broadcast():
|
||||
"""Elementwise Add with trailing-dimension broadcasting."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [2, 3, 4])
|
||||
@@ -1635,17 +1602,6 @@ def mul_channel_broadcast_1024():
|
||||
save_model(model, "mul/channel_broadcast_1024", "mul_channel_broadcast_1024.onnx")
|
||||
|
||||
|
||||
def mul_scalar_runtime():
|
||||
"""Elementwise Mul with a runtime scalar RHS."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
B = helper.make_tensor_value_info("B", TensorProto.FLOAT, [1, 1, 1, 1])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
node = helper.make_node("Mul", ["A", "B"], ["Y"])
|
||||
graph = helper.make_graph([node], "mul_scalar_runtime", [A, B], [Y])
|
||||
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
|
||||
save_model(model, "mul/scalar_runtime", "mul_scalar_runtime.onnx")
|
||||
|
||||
|
||||
def mul_leading_dimension_broadcast():
|
||||
"""Elementwise Mul with trailing-dimension broadcasting."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [2, 3, 4])
|
||||
@@ -1721,17 +1677,6 @@ def div_runtime_scalar_rhs():
|
||||
save_model(model, "div/runtime_scalar_rhs", "div_runtime_scalar_rhs.onnx")
|
||||
|
||||
|
||||
def div_runtime_scalar_lhs():
|
||||
"""Elementwise Div with a scalar constant numerator."""
|
||||
B = helper.make_tensor_value_info("B", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [1, 1024, 1, 1])
|
||||
A = numpy_helper.from_array(np.asarray([[[[2.0]]]], dtype=np.float32), name="A")
|
||||
node = helper.make_node("Div", ["A", "B"], ["Y"])
|
||||
graph = helper.make_graph([node], "div_runtime_scalar_lhs", [B], [Y], initializer=[A])
|
||||
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
|
||||
save_model(model, "div/runtime_scalar_lhs", "div_runtime_scalar_lhs.onnx")
|
||||
|
||||
|
||||
def div_leading_dimension_broadcast():
|
||||
"""Elementwise Div with trailing-dimension broadcasting."""
|
||||
A = helper.make_tensor_value_info("A", TensorProto.FLOAT, [2, 3, 4])
|
||||
@@ -1812,8 +1757,6 @@ if __name__ == "__main__":
|
||||
matmul_huge_1024()
|
||||
matmul_vector_matrix()
|
||||
matmul_matrix_vector()
|
||||
matmul_vector_vector_dot()
|
||||
matmul_batched_4d_broadcast()
|
||||
|
||||
print("\nGenerating Pooling tests:")
|
||||
maxpool_basic()
|
||||
@@ -1899,7 +1842,6 @@ if __name__ == "__main__":
|
||||
add_broadcast_row()
|
||||
add_after_gemm()
|
||||
add_channel_broadcast_1024()
|
||||
add_scalar_runtime()
|
||||
add_leading_dimension_broadcast()
|
||||
|
||||
print("\nGenerating Mul tests:")
|
||||
@@ -1907,7 +1849,6 @@ if __name__ == "__main__":
|
||||
mul_scalar_constant()
|
||||
mul_after_conv()
|
||||
mul_channel_broadcast_1024()
|
||||
mul_scalar_runtime()
|
||||
mul_leading_dimension_broadcast()
|
||||
|
||||
print("\nGenerating Div tests:")
|
||||
@@ -1916,7 +1857,6 @@ if __name__ == "__main__":
|
||||
div_after_gemm()
|
||||
div_channel_broadcast_1024()
|
||||
div_runtime_scalar_rhs()
|
||||
div_runtime_scalar_lhs()
|
||||
div_leading_dimension_broadcast()
|
||||
|
||||
print("\nDone.")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user