description: A placeholder identity operator that is argument-insensitive.
example pseudocode:
self.layer = nn.Sequential(
nn.Dropout(0.5) if dropout else nn.Identity(),
)
description: A placeholder identity operator that is argument-insensitive.
example pseudocode:
self.layer = nn.Sequential(
nn.Dropout(0.5) if dropout else nn.Identity(),
)
identity
thanks
btw where did you find the identity ? i have searched in Zygote and Flux docs, no results found…
If my intuition is right, this is just the regular julia function identity
. Flux and Zygote compose with all julia functions you want to put in, as far as I know. This should also extend to arbitrary packages and user code, it’s one of the strengths of having a full julia stack for this.
okey, i will check it, because i want replicate Pytorch’s Indentity function
How is Pytorch’s identity
different from just identity
function defined as f(x) = x
?
i have not checked Julia’s indentity
There is no difference between using nn.Identity
in PyTorch and identity
in Flux. The whole point of a Julia native ML library is that you don’t need to subclass nn.Module
for everything. Want to use some arbitrary function in a Chain
? Just pass it in, no need to wrap in a layer class. Because of this, there is no reason for us to reinvent the wheel and define an Identity
layer when Julia already has a perfectly good identity
function.