Code Monkey home page Code Monkey logo

batching.jl's People

Contributors

torfjelde avatar

Watchers

 avatar

batching.jl's Issues

`Slices` on Julia 1.9

On Julia 1.8 we have

julia> slices = eachslice(ones(2, 3, 4); dims=2)
Base.Generator{Base.OneTo{Int64}, Base.var"#245#246"{Array{Float64, 3}, Tuple{Colon}, Tuple{Colon}}}(Base.var"#245#246"{Array{Float64, 3}, Tuple{Colon}, Tuple{Colon}}([1.0 1.0 1.0; 1.0 1.0 1.0;;; 1.0 1.0 1.0; 1.0 1.0 1.0;;; 1.0 1.0 1.0; 1.0 1.0 1.0;;; 1.0 1.0 1.0; 1.0 1.0 1.0], (Colon(),), (Colon(),)), Base.OneTo(3))

julia> eltype(slices)
Any

julia> slices[1]
ERROR: MethodError: no method matching getindex(::Base.Generator{Base.OneTo{Int64}, Base.var"#245#246"{Array{Float64, 3}, Tuple{Colon}, Tuple{Colon}}}, ::Int64)
Stacktrace:
 [1] top-level scope
   @ REPL[23]:1

while on Julia 1.9, we have

julia> slices = eachslice(ones(2, 3, 4); dims=2)
3-element Slices{Array{Float64, 3}, Tuple{Colon, Int64, Colon}, Tuple{Base.OneTo{Int64}}, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64, Base.Slice{Base.OneTo{Int64}}}, false}, 1}:
 [1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0]
 [1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0]
 [1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0]

julia> eltype(slices)
SubArray{Float64, 2, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64, Base.Slice{Base.OneTo{Int64}}}, false}

julia> slices[1]
2×4 view(::Array{Float64, 3}, :, 1, :) with eltype Float64:
 1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0

That is, Slices are basically like our ArrayBatch.

As a result, once ≥1.9 becomes standard we can probably just have ArrayBatch wrap a Base.Slices and defer all the functionality to this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.