Access vertex data
NaiveNASlib.inputs
— Methodinputs(v)
Return an Array of vertices which are input to the given vertex.
Examples
julia> using NaiveNASlib, NaiveNASlib.Extend
julia> inputs(CompVertex(identity, InputVertex(1)))
1-element Vector{AbstractVertex}:
InputVertex(1)
NaiveNASlib.outputs
— Methodoutputs(v)
Return an Array of vertices for which the given vertex is input to.
Examples
julia> using NaiveNASlib
julia> iv = inputvertex("in", 3);
julia> cv = invariantvertex(identity, iv);
julia> outputs(iv)
1-element Vector{NaiveNASlib.AbstractVertex}:
MutationVertex(CompVertex(identity, inputs=[in], outputs=[]), NaiveNASlib.SizeInvariant())
NaiveNASlib.nin
— Functionnin(v)
Return the number of input neurons of vertex v
.
This is typically the number of rows/columns of a parameter Matrix
for fully connected layers or the number of input channels in a convolutional layer.
Note that NaiveNASlib does not have the capability to figure this out by itself so this must be provided by the function wrapped in the vertex. For SizeTransparent
vertices, NaiveNASlib will default to computing nin(v)
from the sizes of the inputs.
There are three ways to implement nin
for a function/callable f
of type F
:
1. nin(f::F)
2. nin(st::ST, f) and st = shapetrait(f)
3. nin(f::F, t::MutationTrait, v::AbstractVertex)
While 1
is the most straight forward, 2
can be useful of there are many different f
s which happen to share a common method for determining the size. Option 3
is when the implementation might want to use other information from v
or t
and is left as an escape hatch.
NaiveNASlib.nout
— Functionnout(v)
Return the number of output neurons of vertex v
.
This is typically the number of rows/columns of a parameter Matrix
for fully connected layers or the number of output channels in a convolutional layer.
Note that NaiveNASlib does not have the capability to figure this out by itself so this must be provided by the function wrapped in the vertex. For SizeTransparent
vertices, NaiveNASlib will default to computing nout(v)
from the sizes of the inputs.
There are three ways to implement nin
for a function/callable f
of type F
:
1. nout(f::F)
2. nout(st::ST, f) and st = shapetrait(f)
3. nout(f::F, t::MutationTrait, v::AbstractVertex)
While 1
is the most straight forward, 2
can be useful of there are many different f
s which happen to share a common method for determining the size. Option 3
is when the implementation might want to use other information from v
or t
and is left as an escape hatch.
NaiveNASlib.name
— Functionname(v)
Return a the name of the vertex v
. Will return a generic string describing v
if no name has been given to v
.
Note that names in a graph don't have to be unique.