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
47d6fd28
Commit
47d6fd28
authored
Dec 09, 2022
by
charlie
Browse files
Remove operator-(size_t, dyn_dim), add tests
The operator-(size_t ,dyn_dim) is not used and somewhat bug prone
parent
9738d01d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
src/include/migraphx/shape.hpp
src/include/migraphx/shape.hpp
+0
-1
src/shape.cpp
src/shape.cpp
+0
-4
test/shape_test.cpp
test/shape_test.cpp
+22
-0
No files found.
src/include/migraphx/shape.hpp
View file @
47d6fd28
...
...
@@ -112,7 +112,6 @@ struct shape
friend
dynamic_dimension
operator
+
(
const
dynamic_dimension
&
x
,
const
std
::
size_t
&
y
);
friend
dynamic_dimension
operator
+
(
const
std
::
size_t
&
x
,
const
dynamic_dimension
&
y
);
friend
dynamic_dimension
operator
-
(
const
dynamic_dimension
&
x
,
const
std
::
size_t
&
y
);
friend
dynamic_dimension
operator
-
(
const
std
::
size_t
&
x
,
const
dynamic_dimension
&
y
);
};
static
const
std
::
vector
<
type_t
>&
types
();
...
...
src/shape.cpp
View file @
47d6fd28
...
...
@@ -541,10 +541,6 @@ shape::dynamic_dimension operator-(const shape::dynamic_dimension& x, const std:
{
return
{
x
.
min
-
y
,
x
.
max
-
y
,
x
.
opt
==
0
?
0
:
x
.
opt
-
y
};
}
shape
::
dynamic_dimension
operator
-
(
const
std
::
size_t
&
x
,
const
shape
::
dynamic_dimension
&
y
)
{
return
{
x
-
y
.
min
,
x
-
y
.
max
,
y
.
opt
==
0
?
0
:
x
-
y
.
opt
};
}
bool
operator
==
(
const
shape
&
x
,
const
shape
&
y
)
{
...
...
test/shape_test.cpp
View file @
47d6fd28
...
...
@@ -174,6 +174,28 @@ TEST_CASE(dynamic_dimension_size_t_compares)
EXPECT
(
static_cast
<
std
::
size_t
>
(
2
)
!=
b
);
}
TEST_CASE
(
dynamic_dimension_add_sub_fixed
)
{
using
migraphx
::
shape
;
auto
a
=
shape
::
dynamic_dimension
{
2
,
5
,
2
};
auto
b
=
shape
::
dynamic_dimension
{
3
,
6
,
3
};
EXPECT
((
a
+
1
)
==
b
);
EXPECT
((
1
+
a
)
==
b
);
EXPECT
((
b
-
1
)
==
a
);
auto
c
=
shape
::
dynamic_dimension
{
4
,
7
,
4
};
EXPECT
((
a
+
2
)
==
c
);
EXPECT
((
2
+
a
)
==
c
);
EXPECT
((
c
-
2
)
==
a
);
auto
d
=
shape
::
dynamic_dimension
{
4
,
8
,
0
};
auto
e
=
shape
::
dynamic_dimension
{
2
,
6
,
0
};
EXPECT
((
d
-
2
)
==
e
);
EXPECT
((
e
+
2
)
==
d
);
EXPECT
((
2
+
e
)
==
d
);
}
TEST_CASE
(
test_shape_dynamic_errors
)
{
using
migraphx
::
shape
;
...
...
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