Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
c7c549cc
"vscode:/vscode.git/clone" did not exist on "8e4b10225bde23c8ab122be158ca32ea4a102091"
Commit
c7c549cc
authored
Oct 31, 2018
by
Paul
Browse files
Merge branch 'master' into fp16
parents
c65bacb7
3d57cfed
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
1 deletion
+66
-1
test/dead_code_elimination_test.cpp
test/dead_code_elimination_test.cpp
+17
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+29
-0
test/onnx/imagescaler_test.onnx
test/onnx/imagescaler_test.onnx
+0
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+19
-0
test/op_shape_test.cpp
test/op_shape_test.cpp
+1
-1
No files found.
test/dead_code_elimination_test.cpp
View file @
c7c549cc
...
@@ -43,6 +43,22 @@ void simple_test_nop()
...
@@ -43,6 +43,22 @@ void simple_test_nop()
EXPECT
(
result
!=
migraph
::
literal
{
4
});
EXPECT
(
result
!=
migraph
::
literal
{
4
});
}
}
void
simple_test_nop2
()
{
migraph
::
program
p
;
auto
one
=
p
.
add_literal
(
1
);
auto
two
=
p
.
add_literal
(
2
);
p
.
add_instruction
(
nop
{});
p
.
add_instruction
(
sum_op
{},
one
,
two
);
p
.
add_instruction
(
nop
{});
p
.
compile
(
dce_target
{});
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
2
);
auto
result
=
p
.
eval
({});
EXPECT
(
result
==
migraph
::
literal
{});
EXPECT
(
result
!=
migraph
::
literal
{
4
});
}
void
duplicate_test1
()
void
duplicate_test1
()
{
{
migraph
::
program
p
;
migraph
::
program
p
;
...
@@ -99,6 +115,7 @@ int main()
...
@@ -99,6 +115,7 @@ int main()
{
{
simple_test
();
simple_test
();
simple_test_nop
();
simple_test_nop
();
simple_test_nop2
();
duplicate_test1
();
duplicate_test1
();
duplicate_test2
();
duplicate_test2
();
depth_test
();
depth_test
();
...
...
test/gpu/miopen.cpp
View file @
c7c549cc
...
@@ -175,6 +175,33 @@ struct test_add
...
@@ -175,6 +175,33 @@ struct test_add
}
}
};
};
struct
test_mul
{
migraph
::
program
create_program
()
const
{
migraph
::
program
p
;
migraph
::
shape
s
{
migraph
::
shape
::
float_type
,
{
3
}};
auto
x
=
p
.
add_parameter
(
"x"
,
s
);
auto
y
=
p
.
add_parameter
(
"y"
,
s
);
p
.
add_instruction
(
migraph
::
op
::
mul
{},
x
,
y
);
return
p
;
}
};
struct
test_scale
{
migraph
::
program
create_program
()
const
{
migraph
::
program
p
;
migraph
::
shape
s
{
migraph
::
shape
::
float_type
,
{
3
}};
auto
x
=
p
.
add_parameter
(
"x"
,
s
);
auto
y
=
p
.
add_parameter
(
"y"
,
migraph
::
shape
::
float_type
);
auto
scale
=
p
.
add_instruction
(
migraph
::
op
::
scalar
{
s
},
y
);
p
.
add_instruction
(
migraph
::
op
::
mul
{},
x
,
scale
);
return
p
;
}
};
struct
test_triadd
struct
test_triadd
{
{
migraph
::
program
create_program
()
const
migraph
::
program
create_program
()
const
...
@@ -653,6 +680,8 @@ int main()
...
@@ -653,6 +680,8 @@ int main()
verify_program
<
test_concat
>
();
verify_program
<
test_concat
>
();
verify_program
<
test_concat2
>
();
verify_program
<
test_concat2
>
();
verify_program
<
test_add
>
();
verify_program
<
test_add
>
();
verify_program
<
test_mul
>
();
verify_program
<
test_scale
>
();
verify_program
<
test_triadd
>
();
verify_program
<
test_triadd
>
();
verify_program
<
test_triadd2
>
();
verify_program
<
test_triadd2
>
();
verify_program
<
test_add_broadcast
>
();
verify_program
<
test_add_broadcast
>
();
...
...
test/onnx/imagescaler_test.onnx
0 → 100644
View file @
c7c549cc
File added
test/onnx/onnx_test.cpp
View file @
c7c549cc
...
@@ -100,6 +100,24 @@ void leaky_relu_test()
...
@@ -100,6 +100,24 @@ void leaky_relu_test()
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
void
imagescaler_test
()
{
migraph
::
program
p
;
migraph
::
shape
s
{
migraph
::
shape
::
float_type
,
{
1
,
3
,
16
,
16
}};
auto
l0
=
p
.
add_parameter
(
"0"
,
s
);
auto
scale_val
=
p
.
add_literal
(
0.5
f
);
auto
bias_vals
=
p
.
add_literal
(
migraph
::
literal
{
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
3
}},
{
0.01
,
0.02
,
0.03
}});
auto
scaled_tensor
=
p
.
add_instruction
(
migraph
::
op
::
scalar
{
s
},
scale_val
);
auto
img_scaled
=
p
.
add_instruction
(
migraph
::
op
::
mul
{},
l0
,
scaled_tensor
);
auto
bias_bcast
=
p
.
add_instruction
(
migraph
::
op
::
broadcast
{
1
,
s
},
bias_vals
);
p
.
add_instruction
(
migraph
::
op
::
add
{},
img_scaled
,
bias_bcast
);
auto
prog
=
migraph
::
parse_onnx
(
"imagescaler_test.onnx"
);
EXPECT
(
p
==
prog
);
}
int
main
()
int
main
()
{
{
pytorch_conv_bias_test
();
pytorch_conv_bias_test
();
...
@@ -107,4 +125,5 @@ int main()
...
@@ -107,4 +125,5 @@ int main()
pytorch_conv_bn_relu_maxpool
();
pytorch_conv_bn_relu_maxpool
();
pytorch_conv_relu_maxpool_x2
();
pytorch_conv_relu_maxpool_x2
();
leaky_relu_test
();
leaky_relu_test
();
imagescaler_test
();
}
}
test/op_shape_test.cpp
View file @
c7c549cc
...
@@ -93,7 +93,7 @@ void contiguous_shape()
...
@@ -93,7 +93,7 @@ void contiguous_shape()
throws_shape
(
migraph
::
op
::
contiguous
{},
input
,
input
);
throws_shape
(
migraph
::
op
::
contiguous
{},
input
,
input
);
migraph
::
shape
single
{
migraph
::
shape
::
float_type
,
{
2
}};
migraph
::
shape
single
{
migraph
::
shape
::
float_type
,
{
2
}};
throws
_shape
(
migraph
::
op
::
contiguous
{},
single
);
expect
_shape
(
single
,
migraph
::
op
::
contiguous
{},
single
);
}
}
void
reshape_shape
()
void
reshape_shape
()
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment