Skip to content

Commit 5d207b8

Browse files
authored
Merge pull request #442 from malmaud/active_project
Start Python task in current project environment.
2 parents 0c931a7 + 056250d commit 5d207b8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/TensorFlow.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ end
142142
function load_python_process(;force_reload=false)
143143
if myid() == 1
144144
(pyproc[] > 0 && !force_reload) && return pyproc[] # Python process already loaded
145-
addprocs(1)
145+
withenv("JULIA_PROJECT"=>Base.active_project()) do
146+
addprocs(1)
147+
end
146148
pyproc[] = nprocs()
147149
py_file = joinpath(dirname(@__FILE__), "py.jl")
148150
Base.eval(Main, quote

src/core.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,8 @@ function get_tensor_shape(tensor::AbstractTensor)
18191819
end
18201820

18211821
function get_shape(tensor::AbstractTensor)
1822-
if ismissing(get_tensor_num_dims(tensor))
1822+
# TODO understand/fix why gradient tensors have 'nothing' for their graph
1823+
if get_graph(tensor) === nothing || ismissing(get_tensor_num_dims(tensor))
18231824
return TensorShape([], true)
18241825
else
18251826
return TensorShape(get_tensor_shape(tensor), false)

0 commit comments

Comments
 (0)