-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
8 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,63 +131,3 @@ function compile_python(graphs::AbstractVector{<:AbstractGraph}, framework::Symb | |
end | ||
return leafnum, leafmap | ||
end | ||
|
||
# function to_python_str(graphs::AbstractVector{<:AbstractGraph}, framework::Symbol=:jax) | ||
# if framework == :jax | ||
# head = "" | ||
# elseif framework == :mindspore | ||
# head = "import mindspore as ms\[email protected]\n" | ||
# else | ||
# error("no support for $type framework") | ||
# end | ||
# body = "" | ||
# leafidx = 1 | ||
# root = [id(g) for g in graphs] | ||
# inds_visitedleaf = Int[] | ||
# inds_visitednode = Int[] | ||
# gid_to_leafid = Dict{String, Int64}() | ||
# rootidx = 1 | ||
# for graph in graphs | ||
# for g in PostOrderDFS(graph) #leaf first search | ||
# g_id = id(g) | ||
# target = "g$(g_id)" | ||
# isroot = false | ||
# if g_id in root | ||
# isroot = true | ||
# end | ||
# if isempty(subgraphs(g)) #leaf | ||
# g_id in inds_visitedleaf && continue | ||
# factor_str = factor(g) == 1 ? "" : " * $(factor(g))" | ||
# body *= " $target = l$(leafidx)$factor_str\n" | ||
# gid_to_leafid[target] = leafidx | ||
# leafidx += 1 | ||
# push!(inds_visitedleaf, g_id) | ||
# else | ||
# g_id in inds_visitednode && continue | ||
# factor_str = factor(g) == 1 ? "" : " * $(factor(g))" | ||
# body *= " $target = $(to_pystatic(operator(g), subgraphs(g), subgraph_factors(g)))$factor_str\n" | ||
# push!(inds_visitednode, g_id) | ||
# end | ||
# if isroot | ||
# body *= " out$(rootidx)=$target\n" | ||
# rootidx +=1 | ||
# end | ||
# end | ||
# end | ||
# input = ["l$(i)" for i in 1:leafidx-1] | ||
# input = join(input,",") | ||
# output = ["out$(i)" for i in 1:rootidx-1] | ||
# output = join(output,",") | ||
# head *="def graphfunc($input):\n" | ||
# tail = " return $output\n" | ||
# # tail*= "def to_StaticGraph(leaf):\n" | ||
# # tail*= " output = graphfunc(leaf)\n" | ||
# # tail*= " return output" | ||
# expr = head * body * tail | ||
# println(expr) | ||
# # return head * body * tail | ||
# f = open("GraphFunc.py", "w") | ||
# write(f, expr) | ||
# return expr, leafidx-1, gid_to_leafid | ||
# end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters