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
a740f253
Commit
a740f253
authored
Jun 08, 2018
by
Paul
Browse files
Formatting
parent
1b18e9d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
src/include/rtg/raw_data.hpp
src/include/rtg/raw_data.hpp
+11
-4
src/include/rtg/tensor_view.hpp
src/include/rtg/tensor_view.hpp
+6
-3
No files found.
src/include/rtg/raw_data.hpp
View file @
a740f253
...
...
@@ -6,10 +6,11 @@
namespace
rtg
{
#define RTG_REQUIRES(...) class
=
typename std::enable_if<(__VA_ARGS__)>::type
#define RTG_REQUIRES(...) class
=
typename std::enable_if<(__VA_ARGS__)>::type
struct
raw_data_base
{};
{
};
/**
* @brief Provides a base class for common operations with raw buffer
...
...
@@ -98,7 +99,10 @@ struct raw_data : raw_data_base
auto_cast
get
()
const
{
return
{
static_cast
<
const
Derived
*>
(
this
)};
}
};
template
<
class
T
,
class
U
,
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}),
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
template
<
class
T
,
class
U
,
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}),
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
bool
operator
==
(
const
T
&
x
,
const
U
&
y
)
{
auto
&&
xshape
=
x
.
get_shape
();
...
...
@@ -118,7 +122,10 @@ bool operator==(const T& x, const U& y)
return
result
;
}
template
<
class
T
,
class
U
,
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}),
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
template
<
class
T
,
class
U
,
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}),
RTG_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
bool
operator
!=
(
const
T
&
x
,
const
U
&
y
)
{
return
!
(
x
==
y
);
...
...
src/include/rtg/tensor_view.hpp
View file @
a740f253
...
...
@@ -121,7 +121,7 @@ struct tensor_view
shape
m_shape
;
};
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
bool
operator
==
(
const
tensor_view
<
T
>&
x
,
const
tensor_view
<
U
>&
y
)
{
if
(
x
.
get_shape
()
==
y
.
get_shape
())
...
...
@@ -136,8 +136,11 @@ bool operator==(const tensor_view<T>& x, const tensor_view<U>& y)
return
false
;
}
template
<
class
T
,
class
U
>
bool
operator
!=
(
const
tensor_view
<
T
>&
x
,
const
tensor_view
<
U
>&
y
)
{
return
!
(
x
==
y
);
}
template
<
class
T
,
class
U
>
bool
operator
!=
(
const
tensor_view
<
T
>&
x
,
const
tensor_view
<
U
>&
y
)
{
return
!
(
x
==
y
);
}
template
<
class
T
>
tensor_view
<
T
>
make_view
(
shape
s
,
T
*
data
)
...
...
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