title: Manually set the trainable_variables weights in Tensorflow 2
body: <p>I have to set the trainable_variables value in a model in tensorflow, instead of using optimizer. Is there a function or a way to do it? I show an example code: I want set mnist_model.trainable_variables value.</p>
  
  <pre><code>for epoch in range(0,1):
    with tf.GradientTape() as tape:
    prediction = mnist_model(mnist_images, training=True)
  
  
    loss_value = loss(mnist_labels, prediction)
  
  variables = mnist_model.trainable_variables
  loss_history.append(loss_value.numpy())
  grads = tape.gradient(loss_value, variables)
  </code></pre>