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
edc23800
Commit
edc23800
authored
Feb 11, 2022
by
Shucai Xiao
Browse files
change the data type for lens and strides from size_t to int in the shape class
parent
c7419a9c
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
src/tf/parse_pooling.cpp
src/tf/parse_pooling.cpp
+3
-3
src/tf/parse_shape.cpp
src/tf/parse_shape.cpp
+2
-2
src/tf/parse_stridedslice.cpp
src/tf/parse_stridedslice.cpp
+4
-4
No files found.
src/tf/parse_pooling.cpp
View file @
edc23800
...
...
@@ -23,7 +23,7 @@ struct parse_pooling : op_parser<parse_pooling>
if
(
contains
(
info
.
attributes
,
"strides"
))
{
std
::
vector
<
size_
t
>
stride
;
std
::
vector
<
in
t
>
stride
;
copy
(
info
.
attributes
.
at
(
"strides"
).
list
().
i
(),
std
::
back_inserter
(
stride
));
parser
.
reorder_data
(
stride
);
if
(
stride
.
size
()
!=
4
)
...
...
@@ -35,7 +35,7 @@ struct parse_pooling : op_parser<parse_pooling>
}
if
(
contains
(
info
.
attributes
,
"ksize"
))
{
std
::
vector
<
size_
t
>
ksize
;
std
::
vector
<
in
t
>
ksize
;
copy
(
info
.
attributes
.
at
(
"ksize"
).
list
().
i
(),
std
::
back_inserter
(
ksize
));
parser
.
reorder_data
(
ksize
);
if
(
ksize
.
size
()
!=
4
)
...
...
@@ -57,7 +57,7 @@ struct parse_pooling : op_parser<parse_pooling>
calculate_padding
(
0
,
pads
,
input_dims
[
2
],
op
.
stride
[
0
],
1
,
op
.
lengths
[
0
]);
calculate_padding
(
1
,
pads
,
input_dims
[
3
],
op
.
stride
[
1
],
1
,
op
.
lengths
[
1
]);
op
.
padding
=
std
::
vector
<
size_
t
>
(
pads
.
begin
(),
pads
.
end
());
op
.
padding
=
std
::
vector
<
in
t
>
(
pads
.
begin
(),
pads
.
end
());
}
}
return
info
.
add_instruction
(
op
,
l0
);
...
...
src/tf/parse_shape.cpp
View file @
edc23800
...
...
@@ -19,9 +19,9 @@ struct parse_shape : op_parser<parse_shape>
const
tf_parser
::
node_info
&
info
,
std
::
vector
<
instruction_ref
>
args
)
const
{
std
::
vector
<
std
::
size_
t
>
arg_shape
=
args
[
0
]
->
get_shape
().
lens
();
std
::
vector
<
in
t
>
arg_shape
=
args
[
0
]
->
get_shape
().
lens
();
std
::
vector
<
int32_t
>
vec_shape
(
arg_shape
.
size
());
migraphx
::
shape
s
(
migraphx
::
shape
::
int32_type
,
{
arg_shape
.
size
()});
migraphx
::
shape
s
(
migraphx
::
shape
::
int32_type
,
{
static_cast
<
int
>
(
arg_shape
.
size
()
)
});
std
::
transform
(
arg_shape
.
begin
(),
arg_shape
.
end
(),
vec_shape
.
begin
(),
[](
auto
i
)
{
return
i
;
});
return
info
.
add_literal
(
migraphx
::
literal
{
s
,
vec_shape
});
...
...
src/tf/parse_stridedslice.cpp
View file @
edc23800
...
...
@@ -20,8 +20,8 @@ struct parse_strideslice : op_parser<parse_strideslice>
auto
starts
=
args
[
1
]
->
eval
().
get
<
int32_t
>
().
to_vector
();
auto
ends
=
args
[
2
]
->
eval
().
get
<
int32_t
>
().
to_vector
();
auto
l0
=
args
[
0
];
size_
t
num_axes
=
l0
->
get_shape
().
lens
().
size
();
std
::
vector
<
size_
t
>
axes
=
l0
->
get_shape
().
lens
();
in
t
num_axes
=
l0
->
get_shape
().
lens
().
size
();
std
::
vector
<
in
t
>
axes
=
l0
->
get_shape
().
lens
();
std
::
vector
<
int64_t
>
op_starts
(
starts
.
begin
(),
starts
.
end
());
std
::
vector
<
int64_t
>
op_ends
(
ends
.
begin
(),
ends
.
end
());
...
...
@@ -45,7 +45,7 @@ struct parse_strideslice : op_parser<parse_strideslice>
std
::
vector
<
int64_t
>
begin_axes
=
get_axes_from_mask
(
num_axes
,
begin_mask
);
std
::
vector
<
int64_t
>
end_axes
=
get_axes_from_mask
(
num_axes
,
end_mask
);
for
(
size_
t
i
=
0
;
i
<
num_axes
;
i
++
)
for
(
in
t
i
=
0
;
i
<
num_axes
;
i
++
)
{
if
(
begin_axes
.
at
(
i
)
==
1
)
{
...
...
@@ -62,7 +62,7 @@ struct parse_strideslice : op_parser<parse_strideslice>
if
(
shrink_axis_mask
==
0
)
return
l1
;
for
(
size_
t
i
=
0
;
i
<
num_axes
;
i
++
)
for
(
in
t
i
=
0
;
i
<
num_axes
;
i
++
)
{
// the LSB corresponds to axis 0 when determining which axes to squeeze
if
(((
shrink_axis_mask
>>
i
)
&
bitwise_compare
)
==
1
)
...
...
Prev
1
2
3
4
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