-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
arraysThings about the array abstraction.Things about the array abstraction.good first issueGood for newcomersGood for newcomers
Description
Playing around with Metal I can across some unexpected behavior with OffsetArrays of MtlArrays concerning deepcopy:
julia> a = MtlArray(zeros(Float32, 2));
julia> a = OffsetArray(a, -1);
julia> b = deepcopy(a);
julia> fill!(b, 1);
julia> a
2-element OffsetArray(::MtlVector{Float32, Metal.PrivateStorage}, 0:1) with eltype Float32 with indices 0:1:
1.0
1.0Note that this does not happen on pure MtlArrays
julia> a = MtlArray(zeros(Float32, 2));
julia> b = deepcopy(a);
julia> fill!(b, 1);
julia> a
4-element OffsetArray(::MtlVector{Float32, Metal.PrivateStorage}, 0:3) with eltype Float32 with indices 0:3:
0.0
0.0Nor with OffsetArrays of other types:
julia> a = OffsetArray(zeros(2), -1);
julia> b = deepcopy(a);
julia> fill!(b, 1);
julia> a
2-element OffsetArray(::Vector{Float64}, 0:1) with eltype Float64 with indices 0:1:
0.0
0.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arraysThings about the array abstraction.Things about the array abstraction.good first issueGood for newcomersGood for newcomers