Commit 2fac6fa5 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Add test for non empty int64 scalar

Add one item in the np array to use for the constant we're parsing in.
parent b5e49114
......@@ -647,6 +647,26 @@ def constant_scalar_test2():
return ([node], [], [y])
@onnx_test
def constant_scalar_test3():
x = np.array([1]).astype(np.int64)
y = helper.make_tensor_value_info('0', TensorProto.INT64, [0])
node = onnx.helper.make_node(
'Constant',
inputs=[],
outputs=['0'],
value=onnx.helper.make_tensor(
name='empty_tensor',
data_type=TensorProto.INT64,
dims=x.shape,
vals=x.flatten().astype(np.int64),
),
)
return ([node], [], [y])
@onnx_test
def const_of_shape_empty_input_test():
tensor_val = onnx.helper.make_tensor('value', onnx.TensorProto.INT64, [1],
......
......@@ -646,6 +646,16 @@ TEST_CASE(constant_scalar_test2)
EXPECT(p == prog);
}
TEST_CASE(constant_scalar_test3)
{
migraphx::program p;
auto* mm = p.get_main_module();
mm->add_literal(migraphx::literal{migraphx::shape{migraphx::shape::int64_type, {1}}, {1}});
auto prog = optimize_onnx("constant_scalar_test3.onnx");
EXPECT(p == prog);
}
TEST_CASE(const_of_shape_empty_input_test)
{
migraphx::program p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment