Comments (6)
I think I'm running into this as well. Here's my reduced case (on master of JLD.jl):
julia> immutable Foo
t::Tuple{Float64, Float64}
end
julia> immutable Bar
f::Foo
end
julia> using JLD
julia> JLD.save("test.jld", "bar", Bar(Foo((1.0, 1.0))))
julia> JLD.load("test.jld")
ERROR: stored type Foo does not match currently loaded type
in jldatatype at /Users/jarrettrevels/.julia/v0.4/JLD/src/jld_types.jl:689
in jldatatype at /Users/jarrettrevels/.julia/v0.4/JLD/src/jld_types.jl:679
in read at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:370
in read at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:346
in anonymous at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:1185
in jldopen at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:245
in load at /Users/jarrettrevels/.julia/v0.4/JLD/src/JLD.jl:1184
in load at /Users/jarrettrevels/.julia/v0.4/FileIO/src/loadsave.jl:42
This only seems to occur when the Tuple
is nested within the field of another type. For example, these all work without error:
julia> JLD.save("test.jld", "foo", Foo((1.0, 1.0)))
julia> JLD.load("test.jld")
Dict{ByteString,Any} with 1 entry:
"foo" => Foo((1.0,1.0))
julia> JLD.save("test.jld", "foo", [Foo((1.0, 1.0))])
julia> JLD.load("test.jld")
Dict{ByteString,Any} with 1 entry:
"foo" => [Foo((1.0,1.0))]
julia> JLD.save("test.jld", "foo", Dict("f" => Foo((1.0, 1.0))))
julia> JLD.load("test.jld")
Dict{ByteString,Any} with 1 entry:
"foo" => Dict("f"=>Foo((1.0,1.0)))
Since I'm running from this package's master branch, INLINE_TUPLE = false
. I tried switching it to true
just to see what would happen, and I got ERROR: Error dereferencing object
when calling JLD.load("test.jld")
.
from jld.jl.
I probably have the same problem
type T2
h::Vector{Tuple{Int,Int}}
end
x = T2([(1,2),(2,3)])
@save "x.jld" x
@load "x.jld"
ERROR: MethodError: `jlconvert!` has no method matching jlconvert!(::Ptr{Tuple{Int64,Int64}}, ::Type{Tuple{Int64,Int64}}, ::JLD.JldFile, ::Ptr{UInt8})
Closest candidates are:
jlconvert!(::Ptr{T}, ::Union{Type{Float32},Type{Float64},Type{Int16},Type{Int32},Type{Int64},Type{Int8},Type{UInt16},Type{UInt32},Type{UInt64},Type{UInt8}}, ::JLD.JldFile, ::Ptr{T})
jlconvert!(::Ptr{T}, ::Type{Void}, ::JLD.JldFile, ::Ptr{T})
in read_vals at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:397
in read_array at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:359
in read at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:322
in read_ref at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:448
[inlined code] from /Users/pagnani/.julia/v0.4/JLD/src/jld_types.jl:428
in jlconvert at /Users/pagnani/.julia/v0.4/JLD/src/jld_types.jl:436
in read_scalar at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:348
in read at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:320
in read at /Users/pagnani/.julia/v0.4/JLD/src/JLD.jl:305
in anonymous at no file
The very same problem occurs with a
Type T1
h::Dict{Tuple{Int,Int}, Float64}
end
Is this a known limitation of JLD?
from jld.jl.
@pagnani Did you set INLINE_TUPLE = true
? Does this happen without that change?
from jld.jl.
Well the first lines of jld_types.jl are
# Controls whether tuples and non-pointerfree immutables, which Julia
# stores as references, are stored inline in compound types when
# possible. Currently this is problematic because Julia fields of these
# types may be undefined.
const INLINE_TUPLE = true
from jld.jl.
In the short term, you all might be able to work around this using a custom serializer.
from jld.jl.
Also hitting this. For me, it seems to have to do with what module the type is defined in:
using StaticArrays
using JLD
s = rand(SVector{3});
save("jl.jld", "s", s);
load("jl.jld") # This works!
module M
using StaticArrays
immutable Typ{N,T}
v::SVector{N,T}
end
end
s2 = M.Typ(rand(SVector{3}));
save("jl2.jld", "s2", s2)
load("jl2.jld") # Crashes!
from jld.jl.
Related Issues (20)
- TypeError: No NumPy equivalent for TypeBitfieldID exists
- TagBot trigger issue HOT 14
- Save and read a sharedarray in a jld file HOT 2
- anonymous function can't be saved, in Julia v1.6 HOT 1
- Parametric type load errors with StaticArrays: ERROR: stored type does not match currently loaded type
- Warning: JLD incorrectly extends FileIO functions HOT 3
- cannot append nested parametric types
- unable to load JLD - Core.AbstractArray{#s831,1},#s831 HOT 2
- error on Julia 1.7.0-beta2 HOT 9
- error with loading the jld file containg the reture value of Optim.optimize HOT 1
- JLD and JLD2 don't work in julia 1.7.0 HOT 2
- JLD error when using jldopen on a nested mutable struct before and after loading DSP.jl
- `LoadError: type DataType has no field mutable`
- better error message requested if filename isn't .jld
- How to view .jld files in VScode? HOT 2
- Broken on Julia v1.10 nightly HOT 1
- Storing/loading StepRangeLen fails HOT 2
- WARNING: could not import HDF5.exists into JLD HOT 1
- Warning: object_info is deprecated, use API.h5o_get_info1 instead HOT 1
- Seg Fault when loading large Float16 Arrays in jld files.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jld.jl.