Beispiel #1
0
 def create_brain(architecture,
                  sensor_dim,
                  computation=None,
                  learning=None,
                  random_seed=0):
     np.random.seed(random_seed)
     cortex = neuron.FeedForward([neuron.Neurons(i) for i in architecture])
     return brain.Brain(cortex,
                        create_sensor(sensor_dim),
                        computation=computation,
                        learning=learning)
Beispiel #2
0
def decode_neurons(neurons_proto):
    """Obtain an instance of Neurons from a protobuf.

    Args:
        neurons_proto: The protobuf instance representing the neurons

    Returns:
        The neurons decoded from the protobuf
    """
    layers = [neuron.Neurons(n) for n in neurons_proto.layer]
    return neuron.FeedForward(layers)
Beispiel #3
0
def non_uniform_layers(layers, neurons):
    return neuron.FeedForward([
        layers,
        neurons,
    ])
Beispiel #4
0
def layers():
    return neuron.FeedForward([neuron.Neurons(i, None) for i in (4, 4, 4, 4)])
Beispiel #5
0
def test_feed_forward_custom_input():
    layers = [neuron.Neurons(i) for i in [10, 10, 10]]
    neuron.FeedForward(layers, 'extra')

    for i, layer in enumerate(layers[:-1]):
        layers[i + 1].get('extra')._connected_output == layer.output
Beispiel #6
0
def test_feed_forward():
    layers = [neuron.Neurons(i) for i in [10, 10, 10]]
    neuron.FeedForward(layers)

    for i, layer in enumerate(layers[:-1]):
        layers[i + 1].input._connected_output == layer.output