This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
57 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
module WeightInitializers | ||
|
||
using ChainRulesCore, PartialFunctions, Random, SpecialFunctions, Statistics, LinearAlgebra | ||
#! format: off | ||
using ChainRulesCore: ChainRulesCore | ||
using GPUArraysCore: GPUArraysCore | ||
using LinearAlgebra: LinearAlgebra, Diagonal, qr | ||
using PartialFunctions: :$ | ||
using Random: Random, AbstractRNG, Xoshiro, shuffle | ||
using SpecialFunctions: SpecialFunctions, erf, erfinv | ||
using Statistics: Statistics, std | ||
#! format: on | ||
|
||
const CRC = ChainRulesCore | ||
|
||
include("utils.jl") | ||
include("initializers.jl") | ||
|
||
# Mark the functions as non-differentiable | ||
for f in [:zeros64, :ones64, :rand64, :randn64, :zeros32, :ones32, :rand32, :randn32, | ||
:zeros16, :ones16, :rand16, :randn16, :zerosC64, :onesC64, :randC64, | ||
:randnC64, :zerosC32, :onesC32, :randC32, :randnC32, :zerosC16, :onesC16, | ||
:randC16, :randnC16, :glorot_normal, :glorot_uniform, :kaiming_normal, | ||
:kaiming_uniform, :truncated_normal, :orthogonal, :sparse_init, :identity_init] | ||
@eval @non_differentiable $(f)(::Any...) | ||
end | ||
include("autodiff.jl") | ||
|
||
export zeros64, ones64, rand64, randn64, zeros32, ones32, rand32, randn32, zeros16, ones16, | ||
rand16, randn16 | ||
export zerosC64, onesC64, randC64, randnC64, zerosC32, onesC32, randC32, randnC32, zerosC16, | ||
onesC16, randC16, randnC16 | ||
export glorot_normal, glorot_uniform | ||
export kaiming_normal, kaiming_uniform | ||
export truncated_normal | ||
export orthogonal | ||
export sparse_init | ||
export identity_init | ||
export truncated_normal, orthogonal, sparse_init, identity_init | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Mark the functions as non-differentiable | ||
for f in [:zeros64, :ones64, :rand64, :randn64, :zeros32, :ones32, :rand32, :randn32, | ||
:zeros16, :ones16, :rand16, :randn16, :zerosC64, :onesC64, :randC64, | ||
:randnC64, :zerosC32, :onesC32, :randC32, :randnC32, :zerosC16, :onesC16, | ||
:randC16, :randnC16, :glorot_normal, :glorot_uniform, :kaiming_normal, | ||
:kaiming_uniform, :truncated_normal, :orthogonal, :sparse_init, :identity_init] | ||
@eval CRC.@non_differentiable $(f)(::Any...) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters