class_docstr: A class to support adding sharding attributes to Ops.
  
  Use the factory constructors and then call apply_to_tensor:
    Sharding.replicate().apply_to_tensor(tensor)
docstr: Applies this Sharding attribute to `operation`.
  
  Args:
    operation: A tf.Operation to add sharding annotation.
docstr_tok: ["Applies","this","Sharding","attribute","to","`","operation","`",".","Args",":","operation",":","A","tf.Operation","to","add","sharding","annotation","."]
code: def apply_to_operation(self, operation):
      """Applies this Sharding attribute to `operation`.
  
      Args:
        operation: A tf.Operation to add sharding annotation.
      """
      attr_value = attr_value_pb2.AttrValue(
          s=self._proto.SerializeToString()
      )
      # pylint: disable=protected-access
      operation._set_attr("_XlaSharding", attr_value)
  
imports: import numpy
  from tensorflow.compiler.tf2xla.python import xla
  from local_xla.xla import xla_data_pb2
  from tensorflow.core.framework import attr_value_pb2
label_desc: Use image node_id 10 for calling the Sharding obj's underlying member method code with example usage: obj.apply_to_operation(operation) without return types