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
828017fb
Commit
828017fb
authored
Feb 27, 2019
by
Shucai Xiao
Browse files
clang format
parent
94d13003
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
21 deletions
+14
-21
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+2
-3
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+0
-1
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+8
-8
test/op_shape_test.cpp
test/op_shape_test.cpp
+4
-9
No files found.
src/targets/cpu/gemm.cpp
View file @
828017fb
...
@@ -78,13 +78,12 @@ void migemm_impl(tensor_view<T> cmat,
...
@@ -78,13 +78,12 @@ void migemm_impl(tensor_view<T> cmat,
assert
(
cmat
.
get_shape
().
lens
()[
dim_1
]
==
bmat
.
get_shape
().
lens
()[
dim_1
]);
assert
(
cmat
.
get_shape
().
lens
()[
dim_1
]
==
bmat
.
get_shape
().
lens
()[
dim_1
]);
shape_for_each
(
cmat
.
get_shape
(),
[
&
](
const
auto
&
c_idx
)
{
shape_for_each
(
cmat
.
get_shape
(),
[
&
](
const
auto
&
c_idx
)
{
double
s
=
cmat
(
c_idx
.
begin
(),
c_idx
.
end
())
*
beta
;
double
s
=
cmat
(
c_idx
.
begin
(),
c_idx
.
end
())
*
beta
;
auto
a_idx
=
c_idx
;
auto
a_idx
=
c_idx
;
auto
b_idx
=
c_idx
;
auto
b_idx
=
c_idx
;
dfor
(
k
)([
&
](
auto
kk
)
{
dfor
(
k
)([
&
](
auto
kk
)
{
a_idx
[
dim_1
]
=
b_idx
[
dim_0
]
=
kk
;
a_idx
[
dim_1
]
=
b_idx
[
dim_0
]
=
kk
;
s
+=
amat
(
a_idx
.
begin
(),
a_idx
.
end
())
*
s
+=
amat
(
a_idx
.
begin
(),
a_idx
.
end
())
*
bmat
(
b_idx
.
begin
(),
b_idx
.
end
());
bmat
(
b_idx
.
begin
(),
b_idx
.
end
());
});
});
cmat
(
c_idx
.
begin
(),
c_idx
.
end
())
=
alpha
*
s
;
cmat
(
c_idx
.
begin
(),
c_idx
.
end
())
=
alpha
*
s
;
});
});
...
...
test/gpu/miopen.cpp
View file @
828017fb
...
@@ -836,7 +836,6 @@ struct test_gemm_transposea_ex
...
@@ -836,7 +836,6 @@ struct test_gemm_transposea_ex
}
}
};
};
struct
test_gemm_transposeab
struct
test_gemm_transposeab
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
...
...
test/onnx/onnx_test.cpp
View file @
828017fb
...
@@ -575,17 +575,17 @@ TEST_CASE(gemm_test)
...
@@ -575,17 +575,17 @@ TEST_CASE(gemm_test)
TEST_CASE
(
gemm_ex
)
TEST_CASE
(
gemm_ex
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
6
}});
auto
l0
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
6
}});
auto
l1
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
7
}});
auto
l1
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
7
}});
auto
l2
=
p
.
add_parameter
(
"3"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
6
,
7
}});
auto
l2
=
p
.
add_parameter
(
"3"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
6
,
7
}});
auto
t0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
1
,
3
,
2
}},
l0
);
auto
t0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
1
,
3
,
2
}},
l0
);
auto
alpha
=
0.5
f
;
auto
alpha
=
0.5
f
;
auto
res_ab
=
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
},
t0
,
l1
);
auto
res_ab
=
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
},
t0
,
l1
);
auto
beta
=
0.8
f
;
auto
beta
=
0.8
f
;
auto
l_beta
=
p
.
add_literal
(
beta
);
auto
l_beta
=
p
.
add_literal
(
beta
);
auto
brcst_beta
=
p
.
add_instruction
(
migraphx
::
op
::
scalar
{
l2
->
get_shape
()},
l_beta
);
auto
brcst_beta
=
p
.
add_instruction
(
migraphx
::
op
::
scalar
{
l2
->
get_shape
()},
l_beta
);
auto
res_c
=
p
.
add_instruction
(
migraphx
::
op
::
mul
{},
l2
,
brcst_beta
);
auto
res_c
=
p
.
add_instruction
(
migraphx
::
op
::
mul
{},
l2
,
brcst_beta
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
res_ab
,
res_c
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
res_ab
,
res_c
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_test_ex.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_test_ex.onnx"
);
...
...
test/op_shape_test.cpp
View file @
828017fb
...
@@ -321,10 +321,8 @@ TEST_CASE(dot)
...
@@ -321,10 +321,8 @@ TEST_CASE(dot)
{
{
migraphx
::
shape
s_m1
{
migraphx
::
shape
::
float_type
,
{
4
,
5
}};
migraphx
::
shape
s_m1
{
migraphx
::
shape
::
float_type
,
{
4
,
5
}};
migraphx
::
shape
s_m2
{
migraphx
::
shape
::
float_type
,
{
5
,
8
}};
migraphx
::
shape
s_m2
{
migraphx
::
shape
::
float_type
,
{
5
,
8
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
}},
expect_shape
(
migraphx
::
op
::
dot
{},
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
}},
migraphx
::
op
::
dot
{},
s_m1
,
s_m2
);
s_m1
,
s_m2
);
}
}
{
{
...
@@ -336,10 +334,8 @@ TEST_CASE(dot)
...
@@ -336,10 +334,8 @@ TEST_CASE(dot)
{
{
migraphx
::
shape
s_m1
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}};
migraphx
::
shape
s_m1
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}};
migraphx
::
shape
s_m2
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}};
migraphx
::
shape
s_m2
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}},
expect_shape
(
migraphx
::
op
::
dot
{},
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
}},
migraphx
::
op
::
dot
{},
s_m1
,
s_m2
);
s_m1
,
s_m2
);
}
}
{
{
...
@@ -394,7 +390,6 @@ TEST_CASE(dot)
...
@@ -394,7 +390,6 @@ TEST_CASE(dot)
}
}
}
}
TEST_CASE
(
rnn
)
TEST_CASE
(
rnn
)
{
{
{
{
...
...
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