API
Auto
ChainPlots.chaingraph
— Functionchaingraph(m::Flux.Chain)
Return a MetaGraph representing the graph structure of the neural network.
In this case, the first layer must be a layer with fixed input dimension.
See chaingraph
for the properties of each node of the graph.
ChainPlots.chaingraph
— Methodchaingraph(m::Flux.Chain, input_data::Array)
Return a MetaGraph representing the graph structure of the neural network.
Each node represents a neuron of the Chain m
and contains the following properties: :layer_number
: Int indicating to each layer it belongs ( with 0
indicating the input layer, 1, …, length(m)-1
indicating the hidden layers, and with length(m)
indicating the output layer); :layer_type
: symbol indicating the layer type it is part of in the Chain (e.g. :Dense
, :GRUCell
, :Conv
, …); :index_in_layer
: Tuple
indicating the position of the neuron within the layer. The indices cover the size of the layer, which is given by a Tuple, e.g. of the form (n,)
for Dense(n,m)
and RNN(n,m)
, or (n₁, …, nₖ,m,d,b)
for convolutional layers, and so on; :layer_center
: Float64 with the vertical mid-point of the layer it belongs to.
ChainPlots.chaingraph
— Methodchaingraph(m::Flux.Chain, ldim::Tuple)
Return a MetaGraph representing the graph structure of the neural network with an input of shape ldim
.
See chaingraph
for the properties of each node of the graph.
ChainPlots.chaingraph
— Methodchaingraph(l::Union{Flux.Dense,Flux.Recur,Flux.RNNCell,Flux.LSTMCell,Flux.GRUCell})
Return a MetaGraph representing the graph structure of a neural network composed of the single layer l
.
ChainPlots.get_dimensions
— Methodget_dimensions(m::Flux.Chain, inp::Union{Nothing, Array, Tuple} = nothing)
Return the dimensions of the input and of the output data of each hidden layer.
If input_data
is not given, the first layer is required to be a layer with fixed input dimensions, such as Flux.Dense or Flux.Recur, otherwise the given data or shape is used to infer the dimensions of each layer.
ChainPlots.layerdimensions
— Methodlayerdimensions()
Retrive dimensions of a given fixed-input-size layer.
ChainPlots.layerplotattributes
— Methodlayerplotattributes()
Retrive plot attributes for each specific type of layer.
ChainPlots.neuron_color
— Methodneuron_color(s; neuron_colors = NEURON_COLORS)
Grab the color for each specific type of neuron.
The color depends on the type of layer the neuron belongs to and the colorset given neuron_colors
, which defaults to NEURON_COLORS
.
ChainPlots.neuron_connections
— Functionneuron_connections(m::Flux.Chain, input_data::Union{Nothing,Array,Tuple} = nothing) -> Vector{Dict{Tuple, Vector{Tuple}}}
Return all the connections from every neuron in each layer to the corresponding neurons in the next layer.
ChainPlots.neuron_indices
— Methodneuron_indices(ldim:Tuple) -> Vector{NTuple{N, Int}} where N
Return all possible indices for a given Tuple ldim
.
ChainPlots.plotchain
— Functionplot(m::Flux.Chain, input_data::Union{Nothing,Array,Tuple} = nothing; kargs...)
Plot the topology of Flux.Chain neural network m
.
If the first layer accepts an input with arbitrary dimensions, an input_data
must be provided, we can be a Vector
, an Array
, or just a Tuple
with the dimensions of the input
.
ChainPlots.projection
— Methodprojection(z, center, max_widths, dimensions)
Transform the indexing of a neuron into its x and y coordinates for plotting.
ChainPlots.UnitVector
— TypeUnitVector{T}
Structure for unit vectors in a linear space
Used for generating a basis to infer the layer connection