Skip to content

DnnNet

DnnNet

softneuro.core.DnnNet(*args, **kwargs)

Dnn network class consists of DnnLayer.

This is a private class of softneuro, instance can not be constructed directly,users can get DnnNet instance using Dnn.add_net(), Dnn.find_net(), etc.

Attributes

  • inputs: A series of DnnNetInput objects that consist of input of the network.
  • input_layers: A series of DnnLayer objects that consit of input of the network.
  • layers: A series of DnnLayer objects that consist of the network.
  • name: Name of the network.
  • outputs: A series of DnnNetOutput objects that consist of output of the network.
  • output_layers: A series of DnnLayer objects that consist of output of the network.

add_layer

DnnNet.add_layer(name, type_)

Adds a layer to the network.

Arguments

  • name: The name of the layer.
  • __type___: The type name of the layer. Supported layer types are availabe by softneuro.core.get_layers().

Returns

Type : DnnLayer,Dnnlayer added.


clear

DnnNet.clear()

Clears all layers in the network.


get_input

DnnNet.get_input(input_index)

Returns the input_index-th input of the network.

Arguments

  • input_index: index of the input.

Returns

Type : DnnNetInput,input_index-th input of the network.

Examples

net = dnn.nets[0]
input = net.get_input(1)
# equivalent to :
# input = net.inputs[1]

get_input_layer

DnnNet.get_input_layer(input_index)

Returns the input_index-th layer of the network.

Arguments

  • input_index: Index of the input.

Returns

Type : DnnLayer,input_index-th layer of the network

Examples

net = dnn.nets[0]
input_layer = net.get_input_layer(1)

get_output

DnnNet.get_output(output_index)

Returns the output_index-th output of the network.

Arguments

  • output_index: Index of the output.

Returns

Type : DnnNetOutput,output_index-th output of the network.


get_output_layer

DnnNet.get_output_layer(output_index)

Returns the output_index-th layer of the network.

Arguments

  • output_index: Index of the output.

Returns

Type : DnnLayer,output_index-th layer of the network.

Examples

net = dnn.nets[0]
output_layer = net.get_output_layer(1)

pipe

DnnNet.pipe(i_output_index, io_next_net, i_input_index)

Pipes an output of the network to an input of another network.

Arguments

  • i_output_index: The output index of the current network.
  • io_next_net: The succeeding network to the current network.
  • i_input_index: The input index of the succeeding network.

Examples

See DnnNetInput examples.


remove_layer

DnnNet.remove_layer(layer)

Removes a layer from the network.

Arguments

  • i_layer: The DnnLayer object to be removed from the network.

unpipe

DnnNet.unpipe(i_output_index, io_next_net, i_input_index)

Unpipes an output of the network from an input of another network.

Arguments

  • i_output_index: The output index of the current network where a succeeding network is attached.
  • io_next_net: The succeeding network to the current network.
  • i_input_index: The input index of the succeeding network.