Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
3362f2fa
Commit
3362f2fa
authored
Jun 19, 2018
by
Paul
Browse files
Apply fixits
parent
a5b9ca16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
src/include/rtg/operators.hpp
src/include/rtg/operators.hpp
+2
-2
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+1
-1
No files found.
src/include/rtg/operators.hpp
View file @
3362f2fa
...
...
@@ -431,13 +431,13 @@ struct broadcast
auto
shape1
=
inputs
.
at
(
1
);
auto
shape0_lens
=
shape0
.
lens
();
auto
shape1_lens
=
shape1
.
lens
();
auto
shape0_strides
=
shape0
.
lens
();
const
auto
&
shape0_strides
=
shape0
.
lens
();
auto
shape1_strides
=
shape1
.
lens
();
if
(
std
::
all_of
(
shape0_lens
.
cbegin
(),
shape1_lens
.
cend
(),
[
&
](
auto
x
)
{
return
x
==
1
;
}))
{
if
(
axis
!=
0
)
RTG_THROW
(
"when broadcasting tensor of size 1, axis should be 0"
);
std
::
vector
<
size_t
>
bcast_shape_lens
=
shape0_lens
;
const
std
::
vector
<
size_t
>
&
bcast_shape_lens
=
shape0_lens
;
std
::
vector
<
size_t
>
bcast_shape_strides
(
bcast_shape_lens
.
size
(),
0
);
return
{
t
,
bcast_shape_lens
,
bcast_shape_strides
};
}
...
...
test/cpu_ops_test.cpp
View file @
3362f2fa
...
...
@@ -13,7 +13,7 @@ void fred()
rtg
::
shape
shape1
{
rtg
::
shape
::
float_type
,
{
4
,
3
}};
std
::
vector
<
size_t
>
shape0_lens
=
shape0
.
lens
();
std
::
vector
<
size_t
>
shape1_lens
=
shape1
.
lens
();
std
::
vector
<
size_t
>
shape0_strides
=
shape0
.
strides
();
const
std
::
vector
<
size_t
>
&
shape0_strides
=
shape0
.
strides
();
std
::
vector
<
size_t
>
shape1_strides
=
shape1
.
strides
();
for
(
size_t
i
=
0
;
i
<
shape1
.
lens
().
size
();
i
++
)
{
...
...
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