def _apply_proto_op_extra_attrs(proto_op):
    """Applies applicable attrs to proto_op.extra_attrs.

    The proto op is generated from the original opspec when a batch is
    specified (either as an explicit optimizer or implicitly through a
    batch flag spec). Most of the original operation attributes apply
    to the proto op, but some are different. This function modifies
    proto_op.extra_attrs accordingly.
    """
    proto_op.extra_attrs['run_params']['optimizer'] = None
