Skip to content

Commit 6b566e4

Browse files
author
KDr2
committed
issue 4: handle error in julia automatically
1 parent 4ac3cc0 commit 6b566e4

File tree

4 files changed

+2
-3
lines changed

4 files changed

+2
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ src/autogen-methods.jl
5757
csrc/build/
5858
csrc/libtorch/
5959
deps/lib/
60+
deps/logs/
6061
deps/build.log

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ A Julia interface for PyTorch's C++ backend.
1414
```julia
1515
julia> using ThArrays
1616

17-
julia> handle_error_in_julia() # don't crash when error in libtorch
18-
1917
julia> t = Tensor( -rand(3, 3) )
2018
PyTorch.Tensor{Float64, 2}:
2119
-0.1428 -0.7099 -0.1446

src/ThArrays.jl

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const PROJECT_DIR = (@__DIR__) |> dirname
1111
function __init__()
1212
push!(Libdl.DL_LOAD_PATH, joinpath(PROJECT_DIR, "deps/lib"))
1313
Libdl.dlopen(joinpath(PROJECT_DIR, "deps/lib/libtorch_capi"))
14+
@async handle_error_in_julia()
1415
end
1516

1617
function handle_error_in_julia()

test/issues.jl

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ using Test
44
@testset "Issues Regression" begin
55

66
@testset "Issue 4" begin
7-
handle_error_in_julia()
87
Test.@test_throws ErrorException Tensor(3, requires_grad=true)
98
end
109

0 commit comments

Comments
 (0)