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
121ded22
Commit
121ded22
authored
Jun 15, 2018
by
Scott Thornton
Browse files
Merge branch 'master' of
https://github.com/ROCmSoftwarePlatform/RTGLib
parents
eb6452fa
4148ca64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
17 deletions
+56
-17
src/include/rtg/operators.hpp
src/include/rtg/operators.hpp
+52
-17
src/include/rtg/program.hpp
src/include/rtg/program.hpp
+2
-0
src/program.cpp
src/program.cpp
+2
-0
No files found.
src/include/rtg/operators.hpp
View file @
121ded22
...
@@ -91,6 +91,13 @@ struct convolution
...
@@ -91,6 +91,13 @@ struct convolution
std
::
array
<
std
::
size_t
,
2
>
padding
=
{{
0
,
0
}};
std
::
array
<
std
::
size_t
,
2
>
padding
=
{{
0
,
0
}};
std
::
array
<
std
::
size_t
,
2
>
stride
=
{{
1
,
1
}};
std
::
array
<
std
::
size_t
,
2
>
stride
=
{{
1
,
1
}};
std
::
array
<
std
::
size_t
,
2
>
dilation
=
{{
1
,
1
}};
std
::
array
<
std
::
size_t
,
2
>
dilation
=
{{
1
,
1
}};
enum
padding_mode_t
{
default_
,
// NOLINT
same
,
valid
};
padding_mode_t
padding_mode
=
default_
;
std
::
string
name
()
const
{
return
"convolution"
;
}
std
::
string
name
()
const
{
return
"convolution"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
{
...
@@ -99,23 +106,51 @@ struct convolution
...
@@ -99,23 +106,51 @@ struct convolution
const
shape
&
input
=
inputs
.
at
(
0
);
const
shape
&
input
=
inputs
.
at
(
0
);
const
shape
&
weights
=
inputs
.
at
(
1
);
const
shape
&
weights
=
inputs
.
at
(
1
);
auto
t
=
input
.
type
();
auto
t
=
input
.
type
();
return
{
t
,
if
(
padding_mode
==
default_
)
{
{
input
.
lens
()[
0
],
return
{
t
,
weights
.
lens
()[
0
],
{
std
::
size_t
(
std
::
max
<
std
::
ptrdiff_t
>
(
input
.
lens
()[
0
],
1
,
weights
.
lens
()[
0
],
(
input
.
lens
()[
2
]
-
(
1
+
dilation
[
0
]
*
(
weights
.
lens
()[
2
]
-
1
))
+
std
::
size_t
(
std
::
max
<
std
::
ptrdiff_t
>
(
2
*
padding
[
0
])
/
1
,
stride
[
0
]
+
(
input
.
lens
()[
2
]
-
(
1
+
dilation
[
0
]
*
(
weights
.
lens
()[
2
]
-
1
))
+
1
)),
2
*
padding
[
0
])
/
std
::
size_t
(
std
::
max
<
std
::
ptrdiff_t
>
(
stride
[
0
]
+
1
,
1
)),
(
input
.
lens
()[
3
]
-
(
1
+
dilation
[
1
]
*
(
weights
.
lens
()[
3
]
-
1
))
+
std
::
size_t
(
std
::
max
<
std
::
ptrdiff_t
>
(
2
*
padding
[
1
])
/
1
,
stride
[
1
]
+
(
input
.
lens
()[
3
]
-
(
1
+
dilation
[
1
]
*
(
weights
.
lens
()[
3
]
-
1
))
+
1
)),
2
*
padding
[
1
])
/
}};
stride
[
1
]
+
1
)),
}};
}
else
if
(
padding_mode
==
same
)
{
return
{
t
,
{
input
.
lens
()[
0
],
weights
.
lens
()[
0
],
static_cast
<
std
::
size_t
>
(
std
::
ceil
(
static_cast
<
double
>
(
input
.
lens
()[
2
])
/
stride
[
0
])),
static_cast
<
std
::
size_t
>
(
std
::
ceil
(
static_cast
<
double
>
(
input
.
lens
()[
3
])
/
stride
[
1
]))}};
}
else
if
(
padding_mode
==
valid
)
{
return
{
t
,
{
input
.
lens
()[
0
],
weights
.
lens
()[
0
],
static_cast
<
std
::
size_t
>
(
std
::
ceil
(
static_cast
<
double
>
(
input
.
lens
()[
2
]
-
weights
.
lens
()[
2
]
+
1
)
/
stride
[
0
])),
static_cast
<
std
::
size_t
>
(
std
::
ceil
(
static_cast
<
double
>
(
input
.
lens
()[
3
]
-
weights
.
lens
()[
3
]
+
1
)
/
stride
[
1
]))}};
}
else
{
RTG_THROW
(
"Invalid padding mode"
);
}
}
}
argument
compute
(
shape
,
std
::
vector
<
argument
>
)
const
{
RTG_THROW
(
"not computable"
);
}
argument
compute
(
shape
,
std
::
vector
<
argument
>
)
const
{
RTG_THROW
(
"not computable"
);
}
...
...
src/include/rtg/program.hpp
View file @
121ded22
...
@@ -15,6 +15,8 @@ namespace rtg {
...
@@ -15,6 +15,8 @@ namespace rtg {
struct
program_impl
;
struct
program_impl
;
const
operation
&
get_operation
(
instruction_ref
ins
);
/**
/**
* @brief Stores the instruction stream
* @brief Stores the instruction stream
*/
*/
...
...
src/program.cpp
View file @
121ded22
...
@@ -12,6 +12,8 @@ struct program_impl
...
@@ -12,6 +12,8 @@ struct program_impl
std
::
list
<
instruction
>
instructions
;
std
::
list
<
instruction
>
instructions
;
};
};
const
operation
&
get_operation
(
instruction_ref
ins
)
{
return
ins
->
op
;
}
program
::
program
()
:
impl
(
std
::
make_unique
<
program_impl
>
())
{}
program
::
program
()
:
impl
(
std
::
make_unique
<
program_impl
>
())
{}
program
::
program
(
program
&&
)
noexcept
=
default
;
program
::
program
(
program
&&
)
noexcept
=
default
;
...
...
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