code: def encode_avro(data, schema, name=None):
      """
      Encode Tensors into Avro string.
  
      Args:
          data: A list of Tensors to encode.
          schema: A string of the Avro schema.
          name: A name for the operation (optional).
  
      Returns:
          An Avro-encoded string Tensor.
      """
      # TODO: Use resource to reuse schema initialization
      specs = process_entry(
          json.loads(
              schema.decode() if isinstance(schema, bytes) else schema
          ),
          "",
      )
  
      entries = tf.nest.flatten(specs)
      names = [e.name for e in entries]
  
      data = tf.nest.flatten(data)
  
      values = core_ops.io_encode_avro(data, names, schema, name=name)
      return values
  
file_path: io/tensorflow_io/python/experimental/serialization_ops.py
imports: import json
  import tensorflow
  from tensorflow_io.python.ops import core_ops
label_desc: Use image node_id 8 for calling a global function with example usage: encode_avro(data, schema, name) and returns: values