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
ae0f8e78
Commit
ae0f8e78
authored
Feb 08, 2022
by
Paul
Browse files
Use a json string
parent
94523494
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
36 deletions
+2
-36
src/module.cpp
src/module.cpp
+2
-36
No files found.
src/module.cpp
View file @
ae0f8e78
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/json.hpp>
#include <iostream>
#include <iostream>
#include <sstream>
#include <sstream>
#include <algorithm>
#include <algorithm>
...
@@ -692,48 +693,13 @@ static std::string cpp_var_name(const std::string& name)
...
@@ -692,48 +693,13 @@ static std::string cpp_var_name(const std::string& name)
return
to_c_id
(
"x_"
+
replace_string
(
name
,
":"
,
"_module_"
));
return
to_c_id
(
"x_"
+
replace_string
(
name
,
":"
,
"_module_"
));
}
}
static
void
print_value
(
std
::
ostream
&
os
,
const
value
&
v
)
{
if
(
not
v
.
get_key
().
empty
())
{
os
<<
"{"
;
os
<<
enclose_name
(
v
.
get_key
())
<<
", "
;
print_value
(
os
,
v
.
without_key
());
os
<<
"}"
;
}
else
if
(
v
.
is_array
()
or
v
.
is_object
())
{
char
delim
=
'{'
;
for
(
const
auto
&
x
:
v
)
{
os
<<
delim
;
delim
=
','
;
print_value
(
os
,
x
);
}
os
<<
"}"
;
}
else
if
(
v
.
is_null
())
{
os
<<
"nullptr"
;
}
else
if
(
v
.
is_string
())
{
os
<<
enclose_name
(
v
.
get_string
());
}
else
{
os
<<
v
.
to
<
std
::
string
>
();
}
}
static
void
print_make_op
(
std
::
ostream
&
os
,
const
operation
&
op
)
static
void
print_make_op
(
std
::
ostream
&
os
,
const
operation
&
op
)
{
{
os
<<
"migraphx::make_op("
<<
enclose_name
(
op
.
name
());
os
<<
"migraphx::make_op("
<<
enclose_name
(
op
.
name
());
auto
v
=
op
.
to_value
();
auto
v
=
op
.
to_value
();
if
(
not
v
.
empty
())
if
(
not
v
.
empty
())
{
{
os
<<
", "
;
os
<<
", "
<<
"migraphx::from_json_string("
<<
enclose_name
(
to_json_string
(
v
))
<<
")"
;
print_value
(
os
,
v
);
}
}
os
<<
")"
;
os
<<
")"
;
}
}
...
...
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