def serialize_trained(self,
                        output_file,
                        session = None):
    """Save the current value of all trainable relations in a file.

    Args:
      output_file: Filename string or FileLike object.
      session: (DEPRECATED) a tf.Session used to find values of trained
        SparseTensors
    """
    trained_rels = [
        rel_name for rel_name in self.get_relation_names()
        if self.is_trainable(rel_name)
    ]
    sparse_tensors = [self.get_tf_tensor(rel_name) for rel_name in trained_rels]
    if tf.executing_eagerly():
      trained_dict = {
          name: tensor for name, tensor in zip(trained_rels, sparse_tensors)
      }
    else:
      if session is None:
        session = tf.get_default_session()
      trained_dict = {
          name: tensor
          for name, tensor in zip(trained_rels, session.run(sparse_tensors))
      }
    io.write_sparse_tensor_dict(output_file, trained_dict)
Save the current value of all trainable relations in a file.

    Args:
      output_file: Filename string or FileLike object.
      session: (DEPRECATED) a tf.Session used to find values of trained
        SparseTensors
    
language/nql/nql/__init__.py