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
e234f631
Unverified
Commit
e234f631
authored
Apr 19, 2023
by
Chris Austen
Committed by
GitHub
Apr 19, 2023
Browse files
Merge branch 'develop' into blas_tuning
parents
18cf0435
f92e7994
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
src/py/migraphx_py.cpp
src/py/migraphx_py.cpp
+3
-1
test/py/test_instruction.py
test/py/test_instruction.py
+53
-0
No files found.
src/py/migraphx_py.cpp
View file @
e234f631
...
...
@@ -287,7 +287,9 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
py
::
class_
<
migraphx
::
target
>
(
m
,
"target"
);
py
::
class_
<
migraphx
::
instruction_ref
>
(
m
,
"instruction_ref"
);
py
::
class_
<
migraphx
::
instruction_ref
>
(
m
,
"instruction_ref"
)
.
def
(
"shape"
,
[](
migraphx
::
instruction_ref
i
)
{
return
i
->
get_shape
();
})
.
def
(
"op"
,
[](
migraphx
::
instruction_ref
i
)
{
return
i
->
get_operator
();
});
py
::
class_
<
migraphx
::
module
,
std
::
unique_ptr
<
migraphx
::
module
,
py
::
nodelete
>>
(
m
,
"module"
)
.
def
(
"print"
,
[](
const
migraphx
::
module
&
mm
)
{
std
::
cout
<<
mm
<<
std
::
endl
;
})
...
...
test/py/test_instruction.py
0 → 100755
View file @
e234f631
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
import
migraphx
def
test_instruction_shape
():
p
=
migraphx
.
program
()
mm
=
p
.
get_main_module
()
input_shape
=
migraphx
.
shape
(
lens
=
[
4
,
4
,
64
],
type
=
"half_type"
)
i
=
mm
.
add_parameter
(
"x"
,
input_shape
)
i2
=
mm
.
add_instruction
(
migraphx
.
op
(
"reshape"
,
dims
=
[
16
,
64
]),
[
i
])
out_shape
=
i2
.
shape
()
assert
out_shape
.
lens
()
==
[
16
,
64
]
assert
out_shape
.
strides
()
==
[
64
,
1
]
assert
out_shape
.
type_string
()
==
"half_type"
def
test_instruction_op
():
p
=
migraphx
.
program
()
mm
=
p
.
get_main_module
()
input_shape
=
migraphx
.
shape
(
lens
=
[
2
,
24
])
i
=
mm
.
add_parameter
(
"x"
,
input_shape
)
i2
=
mm
.
add_instruction
(
migraphx
.
op
(
"relu"
),
[
i
])
out_op
=
i2
.
op
()
assert
out_op
.
name
()
==
"relu"
if
__name__
==
"__main__"
:
test_instruction_shape
()
test_instruction_op
()
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