def test_modify_uns_in_copy():
    # https://github.com/theislab/anndata/issues/571
    adata = ad.AnnData(np.ones((5, 5)), uns={"parent": {"key": "value"}})
    adata_copy = adata[:3].copy()
    adata_copy.uns["parent"]["key"] = "new_value"
    assert adata.uns["parent"]["key"] != adata_copy.uns["parent"]["key"]
def update_model(model, disc_grads, gen_grads, disc_opt, gen_opt,
                 global_step, update_scale):
  """Update model with gradients."""

  disc_vars, gen_vars = model.get_variables()

  with tf.control_dependencies(gen_grads + disc_grads):
    disc_update_op = disc_opt.apply_gradients(
        zip(_scale_vars(update_scale, disc_grads),
            disc_vars))

    gen_update_op = gen_opt.apply_gradients(
        zip(_scale_vars(update_scale, gen_grads),
            gen_vars),
        global_step=global_step)

    update_op = tf.group([disc_update_op, gen_update_op])

  return update_op