LuxDL / Lux.jl

Elegant & Performant Scientific Machine Learning in Julia
https://lux.csail.mit.edu/
MIT License
446 stars 50 forks source link

Add Cartesian Embedding methods #670

Closed ldeso closed 1 month ago

ldeso commented 1 month ago

This is an alternative to #668 that adds Cartesian indexing methods to the existing Embedding layer instead of creating a new CartesianEmbedding layer.

Note that this modifies the Embedding composite type from:

struct Embedding <: AbstractExplicitLayer
    in_dims::Int
    out_dims::Int
    init_weight
end

to:

struct Embedding{N} <: AbstractExplicitLayer
    in_dims::NTuple{N, Int}
    out_dims::Int
    init_weight
end

Closes #668.

ldeso commented 1 month ago

Force-pushed because I forgot to capitalize the word "Cartesian" in the documentation.