Skip to content

Commit

Permalink
chore: mark DELayer and PeriodicEmbedding as dep
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Aug 26, 2024
1 parent e6dea49 commit 470b5d9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
20 changes: 17 additions & 3 deletions src/layers/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ case, `layer([a, b, c, d], st) == ([a, d, sinpi(2 / 3.0 * b), sinpi(2 / 1.0 * c)
- `idxs`: Indices of the periodic inputs
- `periods`: Periods of the periodic inputs, in the same order as in `idxs`
!!! danger "Deprecation Notice"
This layer is deprecated and will be removed in v1. Please use the version in
[`Boltz.jl`](https://github.com/LuxDL/Boltz.jl) instead.
# Extended Help
## Inputs
- `x` must be an `AbstractArray` with `issubset(idxs, axes(x, 1))`
Expand Down Expand Up @@ -700,9 +707,16 @@ julia> all(layer([1.1, 2.2, 3.3], ps, st)[1] .==
true
```
"""
@concrete struct PeriodicEmbedding <: AbstractExplicitLayer
idxs
periods
struct PeriodicEmbedding{I, P} <: AbstractExplicitLayer
idxs::I
periods::P

function PeriodicEmbedding(idxs::I, periods::P) where {I, P}
Base.depwarn("`PeriodicEmbedding` is deprecated and will be removed in v1. Please \
use the corresponding version in `Boltz.jl` instead.",
:PeriodicEmbedding)
return new{I, P}(idxs, periods)
end
end

initialstates(::AbstractRNG, p::PeriodicEmbedding) = (k=2 ./ p.periods,)
Expand Down
24 changes: 19 additions & 5 deletions src/layers/extension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ For details about these expressions, refer to the
These options are simply forwarded to `DynamicExpressions.jl`'s `eval_tree_array`
and `eval_grad_tree_array` function.
!!! danger "Deprecation Notice"
These options are deprecated and will be removed in v1. Please use the version in
[`Boltz.jl`](https://github.com/LuxDL/Boltz.jl) instead.
# Extended Help
## Example
Expand Down Expand Up @@ -76,11 +81,20 @@ julia> ∂ps.layer_1.layer_2.params ≈ Float32[-31.0, 90.0]
true
```
"""
@kwdef @concrete struct DynamicExpressionsLayer <: AbstractExplicitLayer
operator_enum
expression
name = nothing
eval_options
struct DynamicExpressionsLayer{OE, E, N, EO} <: AbstractExplicitLayer
operator_enum::OE
expression::E
name::N
eval_options::EO

function DynamicExpressionsLayer(operator_enum::OE, expression::E, name::N,
eval_options::EO) where {OE, E, N, EO}
Base.depwarn(
"`DynamicExpressionsLayer` is deprecated and will be removed in v1. Please \
use the corresponding version in `Boltz.jl` instead.",
:DynamicExpressionsLayer)
return new{OE, E, N, EO}(operator_enum, expression, name, eval_options)
end
end

function Base.show(io::IO, l::DynamicExpressionsLayer)
Expand Down

0 comments on commit 470b5d9

Please sign in to comment.