pymoto.Network

class pymoto.Network(*args, print_timing=False)

Binds multiple Modules together as one Module

Initialize a network with a number of modules that should be executed consecutively >> Network(module1, module2, …)

>> Network([module1, module2, …])

>> Network((module1, module2, …))

Modules can also be constructed using a dictionary based on strings >> Network([ {type=”module1”, sig_in=[sig1, sig2], sig_out=[sig3]},

{type=”module2”, sig_in=[sig3], sig_out=[sig4]} ])

Appending modules to a network will output the signals automatically >> fn = Network() >> s_out = fn.append(module1)

Parameters:

print_timing – Print timing of each module inside this Network

__init__(*args, print_timing=False)

Methods

__init__(*args[, print_timing])

append(*newmods)

connect(sig_in[, sig_out])

Connect without automatic adding to a function network

copy()

get_input_cone([fromsig, frommod])

get_input_sensitivities([as_list])

get_input_states([as_list])

get_output_cone([tosig, tomod])

get_output_sensitivities([as_list])

get_output_states([as_list])

get_subset([fromsig, tosig, include_sinks, ...])

reset()

Reset the state of the sensitivities (they are set to zero or to None)

response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

timefn(fn[, name])

Attributes

active

n_in

Get the number of input signals

n_out

Get the number of output signals

sig_in

All 'stub' input-signals not generated by any module in the network

sig_out

All 'stub' output-signals not used as input by any module in the network

active = ["Network" at 0x72b3349eff10 with modules: ]
timefn(fn, name=None)
response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

Based on the sensitivity we get from sig_out, reverse the process and output the new sensitivities to sig_in

reset()

Reset the state of the sensitivities (they are set to zero or to None)

copy()
append(*newmods)
property sig_in

All ‘stub’ input-signals not generated by any module in the network

property sig_out

All ‘stub’ output-signals not used as input by any module in the network

connect(sig_in: Signal | Iterable[Signal], sig_out: Signal | Iterable[Signal] = None)

Connect without automatic adding to a function network

get_input_cone(fromsig: Signal | Iterable[Signal] = None, frommod: Module | Iterable[Module] = None)
get_input_sensitivities(as_list=False)
get_input_states(as_list=False)
get_output_sensitivities(as_list=False)
get_output_states(as_list=False)
property n_in: int

Get the number of input signals

property n_out: int

Get the number of output signals

Note: Cannot be used in the initial __call__()

get_output_cone(tosig: Signal | Iterable[Signal] = None, tomod: Module | Iterable[Module] = None)
get_subset(fromsig: Signal | Iterable[Signal] = None, tosig: Signal | Iterable[Signal] = None, include_sinks: bool = True, include_sources: bool = True)