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
df46bb45
Commit
df46bb45
authored
Jun 20, 2018
by
Scott Thornton
Browse files
fixed cppcheck + clang formatting
parent
cfbafecb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
24 deletions
+23
-24
src/include/rtg/operators.hpp
src/include/rtg/operators.hpp
+6
-7
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+17
-17
No files found.
src/include/rtg/operators.hpp
View file @
df46bb45
...
@@ -431,7 +431,6 @@ struct broadcast
...
@@ -431,7 +431,6 @@ struct broadcast
auto
shape1
=
inputs
.
at
(
1
);
auto
shape1
=
inputs
.
at
(
1
);
auto
shape0_lens
=
shape0
.
lens
();
auto
shape0_lens
=
shape0
.
lens
();
auto
shape1_lens
=
shape1
.
lens
();
auto
shape1_lens
=
shape1
.
lens
();
const
auto
&
shape0_strides
=
shape0
.
strides
();
auto
shape1_strides
=
shape1
.
strides
();
auto
shape1_strides
=
shape1
.
strides
();
if
(
std
::
all_of
(
shape0_lens
.
cbegin
(),
shape1_lens
.
cend
(),
[
&
](
auto
x
)
{
return
x
==
1
;
}))
if
(
std
::
all_of
(
shape0_lens
.
cbegin
(),
shape1_lens
.
cend
(),
[
&
](
auto
x
)
{
return
x
==
1
;
}))
{
{
...
...
test/cpu_ops_test.cpp
View file @
df46bb45
...
@@ -80,10 +80,10 @@ void add_test()
...
@@ -80,10 +80,10 @@ void add_test()
void
broadcast_test
()
void
broadcast_test
()
{
{
rtg
::
program
p
;
rtg
::
program
p
;
rtg
::
shape
a_shape
{
rtg
::
shape
::
int32_type
,
{
2
,
2
}};
rtg
::
shape
a_shape
{
rtg
::
shape
::
int32_type
,
{
2
,
2
}};
std
::
vector
<
int32_t
>
a_data
{
0
,
0
,
0
,
0
};
std
::
vector
<
int32_t
>
a_data
{
0
,
0
,
0
,
0
};
rtg
::
shape
b_shape
{
rtg
::
shape
::
int32_type
,
{
2
}};
rtg
::
shape
b_shape
{
rtg
::
shape
::
int32_type
,
{
2
}};
std
::
vector
<
int32_t
>
b_data
{
-
2
,
-
3
};
std
::
vector
<
int32_t
>
b_data
{
-
2
,
-
3
};
uint64_t
axis
=
0
;
uint64_t
axis
=
0
;
auto
l1
=
p
.
add_literal
(
rtg
::
literal
{
a_shape
,
a_data
});
auto
l1
=
p
.
add_literal
(
rtg
::
literal
{
a_shape
,
a_data
});
auto
l2
=
p
.
add_literal
(
rtg
::
literal
{
b_shape
,
b_data
});
auto
l2
=
p
.
add_literal
(
rtg
::
literal
{
b_shape
,
b_data
});
...
@@ -102,10 +102,10 @@ void broadcast_test()
...
@@ -102,10 +102,10 @@ void broadcast_test()
void
add_broadcast_test
()
void
add_broadcast_test
()
{
{
rtg
::
program
p
;
rtg
::
program
p
;
rtg
::
shape
a_shape
{
rtg
::
shape
::
float_type
,
{
2
,
2
,
3
}};
rtg
::
shape
a_shape
{
rtg
::
shape
::
float_type
,
{
2
,
2
,
3
}};
std
::
vector
<
float
>
a_data
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
};
std
::
vector
<
float
>
a_data
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
};
rtg
::
shape
b_shape
{
rtg
::
shape
::
float_type
,
{
2
,
2
}};
rtg
::
shape
b_shape
{
rtg
::
shape
::
float_type
,
{
2
,
2
}};
std
::
vector
<
float
>
b_data
{
0
,
-
1
,
-
2
,
-
3
};
std
::
vector
<
float
>
b_data
{
0
,
-
1
,
-
2
,
-
3
};
uint64_t
axis
=
0
;
uint64_t
axis
=
0
;
auto
l1
=
p
.
add_literal
(
rtg
::
literal
{
a_shape
,
a_data
});
auto
l1
=
p
.
add_literal
(
rtg
::
literal
{
a_shape
,
a_data
});
auto
l2
=
p
.
add_literal
(
rtg
::
literal
{
b_shape
,
b_data
});
auto
l2
=
p
.
add_literal
(
rtg
::
literal
{
b_shape
,
b_data
});
...
@@ -115,7 +115,7 @@ void add_broadcast_test()
...
@@ -115,7 +115,7 @@ void add_broadcast_test()
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
std
::
vector
<
float
>
results_vector
(
12
);
std
::
vector
<
float
>
results_vector
(
12
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
gold
=
{
0
,
1
,
2
,
2
,
3
,
4
,
4
,
5
,
6
,
6
,
7
,
8
};
std
::
vector
<
float
>
gold
=
{
0
,
1
,
2
,
2
,
3
,
4
,
4
,
5
,
6
,
6
,
7
,
8
};
EXPECT
(
test
::
verify_range
(
results_vector
,
gold
));
EXPECT
(
test
::
verify_range
(
results_vector
,
gold
));
}
}
...
...
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