示例#1
0
def build_tensor_node(model, node):
    """This is the Nengo build function, so that Nengo knows what to do with
    TensorNodes."""

    # time signal
    if node.pass_time:
        time_in = model.time
    else:
        time_in = None

    # input signal
    if node.shape_in is not None:
        sig_in = builder.Signal(shape=(node.size_in,), name="%s.in" % node)
        model.add_op(Reset(sig_in))
    else:
        sig_in = None

    sig_out = builder.Signal(shape=(node.size_out,), name="%s.out" % node)

    model.sig[node]["in"] = sig_in
    model.sig[node]["out"] = sig_out
    model.params[node] = None

    model.operators.append(
        SimTensorNode(node.tensor_func, time_in, sig_in, sig_out, node.shape_in)
    )
示例#2
0
def build_tensor_node(model, node):
    """This is the Nengo build function, so that Nengo knows what to do with
    TensorNodes."""

    # input signal
    if node.size_in > 0:
        sig_in = builder.Signal(np.zeros(node.size_in), name="%s.in" % node)
        model.add_op(Reset(sig_in))
    else:
        sig_in = None

    sig_out = builder.Signal(np.zeros(node.size_out), name="%s.out" % node)

    model.sig[node]['in'] = sig_in
    model.sig[node]['out'] = sig_out
    model.params[node] = None

    model.add_op(SimTensorNode(node.tensor_func, model.time, sig_in, sig_out))