// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: tensorflow/core/framework/function.proto

package org.tensorflow.proto.framework;

/**
 * <pre>
 * A library is a set of named functions.
 * </pre>
 *
 * Protobuf type {@code tensorflow.FunctionDefLibrary}
 */
public  final class FunctionDefLibrary extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.FunctionDefLibrary)
    FunctionDefLibraryOrBuilder {
private static final long serialVersionUID = 0L;
  // Use FunctionDefLibrary.newBuilder() to construct.
  private FunctionDefLibrary(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private FunctionDefLibrary() {
    function_ = java.util.Collections.emptyList();
    gradient_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new FunctionDefLibrary();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private FunctionDefLibrary(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              function_ = new java.util.ArrayList<org.tensorflow.proto.framework.FunctionDef>();
              mutable_bitField0_ |= 0x00000001;
            }
            function_.add(
                input.readMessage(org.tensorflow.proto.framework.FunctionDef.parser(), extensionRegistry));
            break;
          }
          case 18: {
            if (!((mutable_bitField0_ & 0x00000002) != 0)) {
              gradient_ = new java.util.ArrayList<org.tensorflow.proto.framework.GradientDef>();
              mutable_bitField0_ |= 0x00000002;
            }
            gradient_.add(
                input.readMessage(org.tensorflow.proto.framework.GradientDef.parser(), extensionRegistry));
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        function_ = java.util.Collections.unmodifiableList(function_);
      }
      if (((mutable_bitField0_ & 0x00000002) != 0)) {
        gradient_ = java.util.Collections.unmodifiableList(gradient_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDefLibrary_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDefLibrary_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            org.tensorflow.proto.framework.FunctionDefLibrary.class, org.tensorflow.proto.framework.FunctionDefLibrary.Builder.class);
  }

  public static final int FUNCTION_FIELD_NUMBER = 1;
  private java.util.List<org.tensorflow.proto.framework.FunctionDef> function_;
  /**
   * <code>repeated .tensorflow.FunctionDef function = 1;</code>
   */
  public java.util.List<org.tensorflow.proto.framework.FunctionDef> getFunctionList() {
    return function_;
  }
  /**
   * <code>repeated .tensorflow.FunctionDef function = 1;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.framework.FunctionDefOrBuilder> 
      getFunctionOrBuilderList() {
    return function_;
  }
  /**
   * <code>repeated .tensorflow.FunctionDef function = 1;</code>
   */
  public int getFunctionCount() {
    return function_.size();
  }
  /**
   * <code>repeated .tensorflow.FunctionDef function = 1;</code>
   */
  public org.tensorflow.proto.framework.FunctionDef getFunction(int index) {
    return function_.get(index);
  }
  /**
   * <code>repeated .tensorflow.FunctionDef function = 1;</code>
   */
  public org.tensorflow.proto.framework.FunctionDefOrBuilder getFunctionOrBuilder(
      int index) {
    return function_.get(index);
  }

  public static final int GRADIENT_FIELD_NUMBER = 2;
  private java.util.List<org.tensorflow.proto.framework.GradientDef> gradient_;
  /**
   * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
   */
  public java.util.List<org.tensorflow.proto.framework.GradientDef> getGradientList() {
    return gradient_;
  }
  /**
   * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.framework.GradientDefOrBuilder> 
      getGradientOrBuilderList() {
    return gradient_;
  }
  /**
   * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
   */
  public int getGradientCount() {
    return gradient_.size();
  }
  /**
   * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
   */
  public org.tensorflow.proto.framework.GradientDef getGradient(int index) {
    return gradient_.get(index);
  }
  /**
   * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
   */
  public org.tensorflow.proto.framework.GradientDefOrBuilder getGradientOrBuilder(
      int index) {
    return gradient_.get(index);
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    for (int i = 0; i < function_.size(); i++) {
      output.writeMessage(1, function_.get(i));
    }
    for (int i = 0; i < gradient_.size(); i++) {
      output.writeMessage(2, gradient_.get(i));
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < function_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, function_.get(i));
    }
    for (int i = 0; i < gradient_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, gradient_.get(i));
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof org.tensorflow.proto.framework.FunctionDefLibrary)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.framework.FunctionDefLibrary other = (org.tensorflow.proto.framework.FunctionDefLibrary) obj;

    if (!getFunctionList()
        .equals(other.getFunctionList())) return false;
    if (!getGradientList()
        .equals(other.getGradientList())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getFunctionCount() > 0) {
      hash = (37 * hash) + FUNCTION_FIELD_NUMBER;
      hash = (53 * hash) + getFunctionList().hashCode();
    }
    if (getGradientCount() > 0) {
      hash = (37 * hash) + GRADIENT_FIELD_NUMBER;
      hash = (53 * hash) + getGradientList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDefLibrary parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(org.tensorflow.proto.framework.FunctionDefLibrary prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * <pre>
   * A library is a set of named functions.
   * </pre>
   *
   * Protobuf type {@code tensorflow.FunctionDefLibrary}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.FunctionDefLibrary)
      org.tensorflow.proto.framework.FunctionDefLibraryOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDefLibrary_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDefLibrary_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.framework.FunctionDefLibrary.class, org.tensorflow.proto.framework.FunctionDefLibrary.Builder.class);
    }

    // Construct using org.tensorflow.proto.framework.FunctionDefLibrary.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getFunctionFieldBuilder();
        getGradientFieldBuilder();
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (functionBuilder_ == null) {
        function_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        functionBuilder_.clear();
      }
      if (gradientBuilder_ == null) {
        gradient_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
      } else {
        gradientBuilder_.clear();
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDefLibrary_descriptor;
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.FunctionDefLibrary getDefaultInstanceForType() {
      return org.tensorflow.proto.framework.FunctionDefLibrary.getDefaultInstance();
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.FunctionDefLibrary build() {
      org.tensorflow.proto.framework.FunctionDefLibrary result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public org.tensorflow.proto.framework.FunctionDefLibrary buildPartial() {
      org.tensorflow.proto.framework.FunctionDefLibrary result = new org.tensorflow.proto.framework.FunctionDefLibrary(this);
      int from_bitField0_ = bitField0_;
      if (functionBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          function_ = java.util.Collections.unmodifiableList(function_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.function_ = function_;
      } else {
        result.function_ = functionBuilder_.build();
      }
      if (gradientBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          gradient_ = java.util.Collections.unmodifiableList(gradient_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.gradient_ = gradient_;
      } else {
        result.gradient_ = gradientBuilder_.build();
      }
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof org.tensorflow.proto.framework.FunctionDefLibrary) {
        return mergeFrom((org.tensorflow.proto.framework.FunctionDefLibrary)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.framework.FunctionDefLibrary other) {
      if (other == org.tensorflow.proto.framework.FunctionDefLibrary.getDefaultInstance()) return this;
      if (functionBuilder_ == null) {
        if (!other.function_.isEmpty()) {
          if (function_.isEmpty()) {
            function_ = other.function_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureFunctionIsMutable();
            function_.addAll(other.function_);
          }
          onChanged();
        }
      } else {
        if (!other.function_.isEmpty()) {
          if (functionBuilder_.isEmpty()) {
            functionBuilder_.dispose();
            functionBuilder_ = null;
            function_ = other.function_;
            bitField0_ = (bitField0_ & ~0x00000001);
            functionBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getFunctionFieldBuilder() : null;
          } else {
            functionBuilder_.addAllMessages(other.function_);
          }
        }
      }
      if (gradientBuilder_ == null) {
        if (!other.gradient_.isEmpty()) {
          if (gradient_.isEmpty()) {
            gradient_ = other.gradient_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureGradientIsMutable();
            gradient_.addAll(other.gradient_);
          }
          onChanged();
        }
      } else {
        if (!other.gradient_.isEmpty()) {
          if (gradientBuilder_.isEmpty()) {
            gradientBuilder_.dispose();
            gradientBuilder_ = null;
            gradient_ = other.gradient_;
            bitField0_ = (bitField0_ & ~0x00000002);
            gradientBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getGradientFieldBuilder() : null;
          } else {
            gradientBuilder_.addAllMessages(other.gradient_);
          }
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      org.tensorflow.proto.framework.FunctionDefLibrary parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.framework.FunctionDefLibrary) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.util.List<org.tensorflow.proto.framework.FunctionDef> function_ =
      java.util.Collections.emptyList();
    private void ensureFunctionIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        function_ = new java.util.ArrayList<org.tensorflow.proto.framework.FunctionDef>(function_);
        bitField0_ |= 0x00000001;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.FunctionDef, org.tensorflow.proto.framework.FunctionDef.Builder, org.tensorflow.proto.framework.FunctionDefOrBuilder> functionBuilder_;

    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.FunctionDef> getFunctionList() {
      if (functionBuilder_ == null) {
        return java.util.Collections.unmodifiableList(function_);
      } else {
        return functionBuilder_.getMessageList();
      }
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public int getFunctionCount() {
      if (functionBuilder_ == null) {
        return function_.size();
      } else {
        return functionBuilder_.getCount();
      }
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public org.tensorflow.proto.framework.FunctionDef getFunction(int index) {
      if (functionBuilder_ == null) {
        return function_.get(index);
      } else {
        return functionBuilder_.getMessage(index);
      }
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder setFunction(
        int index, org.tensorflow.proto.framework.FunctionDef value) {
      if (functionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFunctionIsMutable();
        function_.set(index, value);
        onChanged();
      } else {
        functionBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder setFunction(
        int index, org.tensorflow.proto.framework.FunctionDef.Builder builderForValue) {
      if (functionBuilder_ == null) {
        ensureFunctionIsMutable();
        function_.set(index, builderForValue.build());
        onChanged();
      } else {
        functionBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder addFunction(org.tensorflow.proto.framework.FunctionDef value) {
      if (functionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFunctionIsMutable();
        function_.add(value);
        onChanged();
      } else {
        functionBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder addFunction(
        int index, org.tensorflow.proto.framework.FunctionDef value) {
      if (functionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFunctionIsMutable();
        function_.add(index, value);
        onChanged();
      } else {
        functionBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder addFunction(
        org.tensorflow.proto.framework.FunctionDef.Builder builderForValue) {
      if (functionBuilder_ == null) {
        ensureFunctionIsMutable();
        function_.add(builderForValue.build());
        onChanged();
      } else {
        functionBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder addFunction(
        int index, org.tensorflow.proto.framework.FunctionDef.Builder builderForValue) {
      if (functionBuilder_ == null) {
        ensureFunctionIsMutable();
        function_.add(index, builderForValue.build());
        onChanged();
      } else {
        functionBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder addAllFunction(
        java.lang.Iterable<? extends org.tensorflow.proto.framework.FunctionDef> values) {
      if (functionBuilder_ == null) {
        ensureFunctionIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, function_);
        onChanged();
      } else {
        functionBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder clearFunction() {
      if (functionBuilder_ == null) {
        function_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        functionBuilder_.clear();
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public Builder removeFunction(int index) {
      if (functionBuilder_ == null) {
        ensureFunctionIsMutable();
        function_.remove(index);
        onChanged();
      } else {
        functionBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public org.tensorflow.proto.framework.FunctionDef.Builder getFunctionBuilder(
        int index) {
      return getFunctionFieldBuilder().getBuilder(index);
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public org.tensorflow.proto.framework.FunctionDefOrBuilder getFunctionOrBuilder(
        int index) {
      if (functionBuilder_ == null) {
        return function_.get(index);  } else {
        return functionBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.framework.FunctionDefOrBuilder> 
         getFunctionOrBuilderList() {
      if (functionBuilder_ != null) {
        return functionBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(function_);
      }
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public org.tensorflow.proto.framework.FunctionDef.Builder addFunctionBuilder() {
      return getFunctionFieldBuilder().addBuilder(
          org.tensorflow.proto.framework.FunctionDef.getDefaultInstance());
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public org.tensorflow.proto.framework.FunctionDef.Builder addFunctionBuilder(
        int index) {
      return getFunctionFieldBuilder().addBuilder(
          index, org.tensorflow.proto.framework.FunctionDef.getDefaultInstance());
    }
    /**
     * <code>repeated .tensorflow.FunctionDef function = 1;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.FunctionDef.Builder> 
         getFunctionBuilderList() {
      return getFunctionFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.FunctionDef, org.tensorflow.proto.framework.FunctionDef.Builder, org.tensorflow.proto.framework.FunctionDefOrBuilder> 
        getFunctionFieldBuilder() {
      if (functionBuilder_ == null) {
        functionBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.framework.FunctionDef, org.tensorflow.proto.framework.FunctionDef.Builder, org.tensorflow.proto.framework.FunctionDefOrBuilder>(
                function_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        function_ = null;
      }
      return functionBuilder_;
    }

    private java.util.List<org.tensorflow.proto.framework.GradientDef> gradient_ =
      java.util.Collections.emptyList();
    private void ensureGradientIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        gradient_ = new java.util.ArrayList<org.tensorflow.proto.framework.GradientDef>(gradient_);
        bitField0_ |= 0x00000002;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.GradientDef, org.tensorflow.proto.framework.GradientDef.Builder, org.tensorflow.proto.framework.GradientDefOrBuilder> gradientBuilder_;

    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.GradientDef> getGradientList() {
      if (gradientBuilder_ == null) {
        return java.util.Collections.unmodifiableList(gradient_);
      } else {
        return gradientBuilder_.getMessageList();
      }
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public int getGradientCount() {
      if (gradientBuilder_ == null) {
        return gradient_.size();
      } else {
        return gradientBuilder_.getCount();
      }
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public org.tensorflow.proto.framework.GradientDef getGradient(int index) {
      if (gradientBuilder_ == null) {
        return gradient_.get(index);
      } else {
        return gradientBuilder_.getMessage(index);
      }
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder setGradient(
        int index, org.tensorflow.proto.framework.GradientDef value) {
      if (gradientBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureGradientIsMutable();
        gradient_.set(index, value);
        onChanged();
      } else {
        gradientBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder setGradient(
        int index, org.tensorflow.proto.framework.GradientDef.Builder builderForValue) {
      if (gradientBuilder_ == null) {
        ensureGradientIsMutable();
        gradient_.set(index, builderForValue.build());
        onChanged();
      } else {
        gradientBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder addGradient(org.tensorflow.proto.framework.GradientDef value) {
      if (gradientBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureGradientIsMutable();
        gradient_.add(value);
        onChanged();
      } else {
        gradientBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder addGradient(
        int index, org.tensorflow.proto.framework.GradientDef value) {
      if (gradientBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureGradientIsMutable();
        gradient_.add(index, value);
        onChanged();
      } else {
        gradientBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder addGradient(
        org.tensorflow.proto.framework.GradientDef.Builder builderForValue) {
      if (gradientBuilder_ == null) {
        ensureGradientIsMutable();
        gradient_.add(builderForValue.build());
        onChanged();
      } else {
        gradientBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder addGradient(
        int index, org.tensorflow.proto.framework.GradientDef.Builder builderForValue) {
      if (gradientBuilder_ == null) {
        ensureGradientIsMutable();
        gradient_.add(index, builderForValue.build());
        onChanged();
      } else {
        gradientBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder addAllGradient(
        java.lang.Iterable<? extends org.tensorflow.proto.framework.GradientDef> values) {
      if (gradientBuilder_ == null) {
        ensureGradientIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, gradient_);
        onChanged();
      } else {
        gradientBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder clearGradient() {
      if (gradientBuilder_ == null) {
        gradient_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        gradientBuilder_.clear();
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public Builder removeGradient(int index) {
      if (gradientBuilder_ == null) {
        ensureGradientIsMutable();
        gradient_.remove(index);
        onChanged();
      } else {
        gradientBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public org.tensorflow.proto.framework.GradientDef.Builder getGradientBuilder(
        int index) {
      return getGradientFieldBuilder().getBuilder(index);
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public org.tensorflow.proto.framework.GradientDefOrBuilder getGradientOrBuilder(
        int index) {
      if (gradientBuilder_ == null) {
        return gradient_.get(index);  } else {
        return gradientBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.framework.GradientDefOrBuilder> 
         getGradientOrBuilderList() {
      if (gradientBuilder_ != null) {
        return gradientBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(gradient_);
      }
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public org.tensorflow.proto.framework.GradientDef.Builder addGradientBuilder() {
      return getGradientFieldBuilder().addBuilder(
          org.tensorflow.proto.framework.GradientDef.getDefaultInstance());
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public org.tensorflow.proto.framework.GradientDef.Builder addGradientBuilder(
        int index) {
      return getGradientFieldBuilder().addBuilder(
          index, org.tensorflow.proto.framework.GradientDef.getDefaultInstance());
    }
    /**
     * <code>repeated .tensorflow.GradientDef gradient = 2;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.GradientDef.Builder> 
         getGradientBuilderList() {
      return getGradientFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.GradientDef, org.tensorflow.proto.framework.GradientDef.Builder, org.tensorflow.proto.framework.GradientDefOrBuilder> 
        getGradientFieldBuilder() {
      if (gradientBuilder_ == null) {
        gradientBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.framework.GradientDef, org.tensorflow.proto.framework.GradientDef.Builder, org.tensorflow.proto.framework.GradientDefOrBuilder>(
                gradient_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        gradient_ = null;
      }
      return gradientBuilder_;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:tensorflow.FunctionDefLibrary)
  }

  // @@protoc_insertion_point(class_scope:tensorflow.FunctionDefLibrary)
  private static final org.tensorflow.proto.framework.FunctionDefLibrary DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new org.tensorflow.proto.framework.FunctionDefLibrary();
  }

  public static org.tensorflow.proto.framework.FunctionDefLibrary getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<FunctionDefLibrary>
      PARSER = new com.google.protobuf.AbstractParser<FunctionDefLibrary>() {
    @java.lang.Override
    public FunctionDefLibrary parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new FunctionDefLibrary(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<FunctionDefLibrary> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<FunctionDefLibrary> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public org.tensorflow.proto.framework.FunctionDefLibrary getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

