How to use the nengo.builder.connection.get_targets function in nengo

To help you get started, we’ve selected a few nengo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SpiNNakerManchester / SpiNNakerGraphFrontEnd / spinnaker_graph_front_end / examples / nengo / overridden_mapping_algorithms / nengo_application_graph_builder.py View on Github external
# fudge to support the built in nengo demanding a god object with params
        model = ModelWrapper(nengo_to_app_graph_map, decoder_cache)

        # gets encoders, gains, anf bias's from the application vertex
        encoders = nengo_to_app_graph_map[nengo_connection.pre_obj].encoders
        gain = nengo_to_app_graph_map[nengo_connection.pre_obj].gain
        bias = nengo_to_app_graph_map[nengo_connection.pre_obj].bias

        eval_points = nengo_connection_builder.get_eval_points(
            model, nengo_connection, random_number_generator)

        # TODO Figure out which version this is meant to support and use only
        # TODO that one
        try:
            targets = nengo_connection_builder.get_targets(
                model, nengo_connection, eval_points)
        except:  # yuck
            # nengo <= 2.3.0
            targets = nengo_connection_builder.get_targets(
                model, nengo_connection, eval_points)

        x = numpy.dot(eval_points, encoders.T / nengo_connection.pre_obj.radius)
        e = None
        if nengo_connection.solver.weights:
            e = nengo_to_app_graph_map[
                nengo_connection.post_obj].scaled_encoders.T[
                nengo_connection.post_slice]

            # include transform in solved weights
            targets = nengo_connection_builder.multiply(
                targets, nengo_connection.transform.T)
github SpiNNakerManchester / SpiNNakerGraphFrontEnd / spinnaker_graph_front_end / examples / nengo / overridden_mapping_algorithms / nengo_application_graph_builder.py View on Github external
# gets encoders, gains, anf bias's from the application vertex
        encoders = nengo_to_app_graph_map[nengo_connection.pre_obj].encoders
        gain = nengo_to_app_graph_map[nengo_connection.pre_obj].gain
        bias = nengo_to_app_graph_map[nengo_connection.pre_obj].bias

        eval_points = nengo_connection_builder.get_eval_points(
            model, nengo_connection, random_number_generator)

        # TODO Figure out which version this is meant to support and use only
        # TODO that one
        try:
            targets = nengo_connection_builder.get_targets(
                model, nengo_connection, eval_points)
        except:  # yuck
            # nengo <= 2.3.0
            targets = nengo_connection_builder.get_targets(
                model, nengo_connection, eval_points)

        x = numpy.dot(eval_points, encoders.T / nengo_connection.pre_obj.radius)
        e = None
        if nengo_connection.solver.weights:
            e = nengo_to_app_graph_map[
                nengo_connection.post_obj].scaled_encoders.T[
                nengo_connection.post_slice]

            # include transform in solved weights
            targets = nengo_connection_builder.multiply(
                targets, nengo_connection.transform.T)

        try:
            wrapped_solver = model.decoder_cache.wrap_solver(
                nengo_connection_builder.solve_for_decoders)