Update weights for encoder and decoder

Hi everyone, pretty new in neural network and mostly in Nengo. Im trying to recreate a model from keras in nengo in order to make it work on the Loihi architecture. The autoencoder is pretty simple,

  1. input layer
  2. encoder dense layer
  3. decoder dense layer
    The only problem is that not all the input layer are connected with the encoder dense layer and the same rule apply to the decoder part. In order to dont let some input contribute to some specific node i made a function that multiply the weights to zero. This is an example
    #1 Build model network

`import nengo
import nengo_loihi
import numpy as np
import nengo_dl

n_in = 784
n_hidden = 64
minibatch_size = 50

with nengo.Network() as auto_net:
# input
nengo_a = nengo.Node(np.zeros(n_in))
# first layer
nengo_b = nengo.Ensemble(n_in, dimensions=10)
nengo.Connection(nengo_a, nengo_b.neurons, transform=nengo_dl.dists.Glorot())
# second layer
nengo_c = nengo.Ensemble(10, dimensions=n_in)
nengo.Connection(
nengo_b.neurons, nengo_c.neurons, transform=nengo_dl.dists.Glorot())
# probes are used to collect data from the network
p_c = nengo.Probe(nengo_c.neurons)`

Here is instead my update weights function using the mask

def update_weights(t):
# Create a matrix of 1s and 0s
mask = np.random.randint(2, size=(n_in, 10))
# Modify the weights of the connections by multiplying them by the mask
nengo_b.neurons.weights *= mask
nengo_c.neurons.weights *= mask

My question is, how should i use the update_weights function? i tried to create the update_process but i have an error
update_process = nengo.Process(update_weights)

Thanks!