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

package org.tensorflow.proto.framework;

/**
 * <pre>
 * A function can be instantiated when the runtime can bind every attr
 * with a value. When a GraphDef has a call to a function, it must
 * have binding for every attr defined in the signature.
 * TODO(zhifengc):
 *   * device spec, etc.
 * </pre>
 *
 * Protobuf type {@code tensorflow.FunctionDef}
 */
public  final class FunctionDef extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.FunctionDef)
    FunctionDefOrBuilder {
private static final long serialVersionUID = 0L;
  // Use FunctionDef.newBuilder() to construct.
  private FunctionDef(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private FunctionDef() {
    nodeDef_ = java.util.Collections.emptyList();
  }

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

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private FunctionDef(
      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: {
            org.tensorflow.proto.framework.OpDef.Builder subBuilder = null;
            if (signature_ != null) {
              subBuilder = signature_.toBuilder();
            }
            signature_ = input.readMessage(org.tensorflow.proto.framework.OpDef.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(signature_);
              signature_ = subBuilder.buildPartial();
            }

            break;
          }
          case 26: {
            if (!((mutable_bitField0_ & 0x00000008) != 0)) {
              nodeDef_ = new java.util.ArrayList<org.tensorflow.proto.framework.NodeDef>();
              mutable_bitField0_ |= 0x00000008;
            }
            nodeDef_.add(
                input.readMessage(org.tensorflow.proto.framework.NodeDef.parser(), extensionRegistry));
            break;
          }
          case 34: {
            if (!((mutable_bitField0_ & 0x00000010) != 0)) {
              ret_ = com.google.protobuf.MapField.newMapField(
                  RetDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000010;
            }
            com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
            ret__ = input.readMessage(
                RetDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            ret_.getMutableMap().put(
                ret__.getKey(), ret__.getValue());
            break;
          }
          case 42: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              attr_ = com.google.protobuf.MapField.newMapField(
                  AttrDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000001;
            }
            com.google.protobuf.MapEntry<java.lang.String, org.tensorflow.proto.framework.AttrValue>
            attr__ = input.readMessage(
                AttrDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            attr_.getMutableMap().put(
                attr__.getKey(), attr__.getValue());
            break;
          }
          case 50: {
            if (!((mutable_bitField0_ & 0x00000020) != 0)) {
              controlRet_ = com.google.protobuf.MapField.newMapField(
                  ControlRetDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000020;
            }
            com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
            controlRet__ = input.readMessage(
                ControlRetDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            controlRet_.getMutableMap().put(
                controlRet__.getKey(), controlRet__.getValue());
            break;
          }
          case 58: {
            if (!((mutable_bitField0_ & 0x00000002) != 0)) {
              argAttr_ = com.google.protobuf.MapField.newMapField(
                  ArgAttrDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000002;
            }
            com.google.protobuf.MapEntry<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
            argAttr__ = input.readMessage(
                ArgAttrDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            argAttr_.getMutableMap().put(
                argAttr__.getKey(), argAttr__.getValue());
            break;
          }
          case 66: {
            if (!((mutable_bitField0_ & 0x00000004) != 0)) {
              resourceArgUniqueId_ = com.google.protobuf.MapField.newMapField(
                  ResourceArgUniqueIdDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000004;
            }
            com.google.protobuf.MapEntry<java.lang.Integer, java.lang.Integer>
            resourceArgUniqueId__ = input.readMessage(
                ResourceArgUniqueIdDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            resourceArgUniqueId_.getMutableMap().put(
                resourceArgUniqueId__.getKey(), resourceArgUniqueId__.getValue());
            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_ & 0x00000008) != 0)) {
        nodeDef_ = java.util.Collections.unmodifiableList(nodeDef_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(
      int number) {
    switch (number) {
      case 5:
        return internalGetAttr();
      case 7:
        return internalGetArgAttr();
      case 8:
        return internalGetResourceArgUniqueId();
      case 4:
        return internalGetRet();
      case 6:
        return internalGetControlRet();
      default:
        throw new RuntimeException(
            "Invalid map field number: " + number);
    }
  }
  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            org.tensorflow.proto.framework.FunctionDef.class, org.tensorflow.proto.framework.FunctionDef.Builder.class);
  }

  public interface ArgAttrsOrBuilder extends
      // @@protoc_insertion_point(interface_extends:tensorflow.FunctionDef.ArgAttrs)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */
    int getAttrCount();
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */
    boolean containsAttr(
        java.lang.String key);
    /**
     * Use {@link #getAttrMap()} instead.
     */
    @java.lang.Deprecated
    java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    getAttr();
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */
    java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    getAttrMap();
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    org.tensorflow.proto.framework.AttrValue getAttrOrDefault(
        java.lang.String key,
        org.tensorflow.proto.framework.AttrValue defaultValue);
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    org.tensorflow.proto.framework.AttrValue getAttrOrThrow(
        java.lang.String key);
  }
  /**
   * <pre>
   * Attributes for function arguments. These attributes are the same set of
   * valid attributes as to _Arg nodes.
   * </pre>
   *
   * Protobuf type {@code tensorflow.FunctionDef.ArgAttrs}
   */
  public  static final class ArgAttrs extends
      com.google.protobuf.GeneratedMessageV3 implements
      // @@protoc_insertion_point(message_implements:tensorflow.FunctionDef.ArgAttrs)
      ArgAttrsOrBuilder {
  private static final long serialVersionUID = 0L;
    // Use ArgAttrs.newBuilder() to construct.
    private ArgAttrs(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }
    private ArgAttrs() {
    }

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

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
      return this.unknownFields;
    }
    private ArgAttrs(
        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)) {
                attr_ = com.google.protobuf.MapField.newMapField(
                    AttrDefaultEntryHolder.defaultEntry);
                mutable_bitField0_ |= 0x00000001;
              }
              com.google.protobuf.MapEntry<java.lang.String, org.tensorflow.proto.framework.AttrValue>
              attr__ = input.readMessage(
                  AttrDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
              attr_.getMutableMap().put(
                  attr__.getKey(), attr__.getValue());
              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 {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrs_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    @java.lang.Override
    protected com.google.protobuf.MapField internalGetMapField(
        int number) {
      switch (number) {
        case 1:
          return internalGetAttr();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrs_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.framework.FunctionDef.ArgAttrs.class, org.tensorflow.proto.framework.FunctionDef.ArgAttrs.Builder.class);
    }

    public static final int ATTR_FIELD_NUMBER = 1;
    private static final class AttrDefaultEntryHolder {
      static final com.google.protobuf.MapEntry<
          java.lang.String, org.tensorflow.proto.framework.AttrValue> defaultEntry =
              com.google.protobuf.MapEntry
              .<java.lang.String, org.tensorflow.proto.framework.AttrValue>newDefaultInstance(
                  org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrs_AttrEntry_descriptor, 
                  com.google.protobuf.WireFormat.FieldType.STRING,
                  "",
                  com.google.protobuf.WireFormat.FieldType.MESSAGE,
                  org.tensorflow.proto.framework.AttrValue.getDefaultInstance());
    }
    private com.google.protobuf.MapField<
        java.lang.String, org.tensorflow.proto.framework.AttrValue> attr_;
    private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    internalGetAttr() {
      if (attr_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            AttrDefaultEntryHolder.defaultEntry);
      }
      return attr_;
    }

    public int getAttrCount() {
      return internalGetAttr().getMap().size();
    }
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    public boolean containsAttr(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetAttr().getMap().containsKey(key);
    }
    /**
     * Use {@link #getAttrMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttr() {
      return getAttrMap();
    }
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttrMap() {
      return internalGetAttr().getMap();
    }
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    public org.tensorflow.proto.framework.AttrValue getAttrOrDefault(
        java.lang.String key,
        org.tensorflow.proto.framework.AttrValue defaultValue) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
          internalGetAttr().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
     */

    public org.tensorflow.proto.framework.AttrValue getAttrOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
          internalGetAttr().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    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 {
      com.google.protobuf.GeneratedMessageV3
        .serializeStringMapTo(
          output,
          internalGetAttr(),
          AttrDefaultEntryHolder.defaultEntry,
          1);
      unknownFields.writeTo(output);
    }

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

      size = 0;
      for (java.util.Map.Entry<java.lang.String, org.tensorflow.proto.framework.AttrValue> entry
           : internalGetAttr().getMap().entrySet()) {
        com.google.protobuf.MapEntry<java.lang.String, org.tensorflow.proto.framework.AttrValue>
        attr__ = AttrDefaultEntryHolder.defaultEntry.newBuilderForType()
            .setKey(entry.getKey())
            .setValue(entry.getValue())
            .build();
        size += com.google.protobuf.CodedOutputStream
            .computeMessageSize(1, attr__);
      }
      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.FunctionDef.ArgAttrs)) {
        return super.equals(obj);
      }
      org.tensorflow.proto.framework.FunctionDef.ArgAttrs other = (org.tensorflow.proto.framework.FunctionDef.ArgAttrs) obj;

      if (!internalGetAttr().equals(
          other.internalGetAttr())) 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 (!internalGetAttr().getMap().isEmpty()) {
        hash = (37 * hash) + ATTR_FIELD_NUMBER;
        hash = (53 * hash) + internalGetAttr().hashCode();
      }
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs 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.FunctionDef.ArgAttrs parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs 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.FunctionDef.ArgAttrs parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs 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.FunctionDef.ArgAttrs parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs 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.FunctionDef.ArgAttrs parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.FunctionDef.ArgAttrs 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.FunctionDef.ArgAttrs 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>
     * Attributes for function arguments. These attributes are the same set of
     * valid attributes as to _Arg nodes.
     * </pre>
     *
     * Protobuf type {@code tensorflow.FunctionDef.ArgAttrs}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:tensorflow.FunctionDef.ArgAttrs)
        org.tensorflow.proto.framework.FunctionDef.ArgAttrsOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrs_descriptor;
      }

      @SuppressWarnings({"rawtypes"})
      protected com.google.protobuf.MapField internalGetMapField(
          int number) {
        switch (number) {
          case 1:
            return internalGetAttr();
          default:
            throw new RuntimeException(
                "Invalid map field number: " + number);
        }
      }
      @SuppressWarnings({"rawtypes"})
      protected com.google.protobuf.MapField internalGetMutableMapField(
          int number) {
        switch (number) {
          case 1:
            return internalGetMutableAttr();
          default:
            throw new RuntimeException(
                "Invalid map field number: " + number);
        }
      }
      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrs_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.tensorflow.proto.framework.FunctionDef.ArgAttrs.class, org.tensorflow.proto.framework.FunctionDef.ArgAttrs.Builder.class);
      }

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

      private Builder(
          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3
                .alwaysUseFieldBuilders) {
        }
      }
      @java.lang.Override
      public Builder clear() {
        super.clear();
        internalGetMutableAttr().clear();
        return this;
      }

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

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

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

      @java.lang.Override
      public org.tensorflow.proto.framework.FunctionDef.ArgAttrs buildPartial() {
        org.tensorflow.proto.framework.FunctionDef.ArgAttrs result = new org.tensorflow.proto.framework.FunctionDef.ArgAttrs(this);
        int from_bitField0_ = bitField0_;
        result.attr_ = internalGetAttr();
        result.attr_.makeImmutable();
        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.FunctionDef.ArgAttrs) {
          return mergeFrom((org.tensorflow.proto.framework.FunctionDef.ArgAttrs)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.tensorflow.proto.framework.FunctionDef.ArgAttrs other) {
        if (other == org.tensorflow.proto.framework.FunctionDef.ArgAttrs.getDefaultInstance()) return this;
        internalGetMutableAttr().mergeFrom(
            other.internalGetAttr());
        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.FunctionDef.ArgAttrs parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.tensorflow.proto.framework.FunctionDef.ArgAttrs) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private com.google.protobuf.MapField<
          java.lang.String, org.tensorflow.proto.framework.AttrValue> attr_;
      private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
      internalGetAttr() {
        if (attr_ == null) {
          return com.google.protobuf.MapField.emptyMapField(
              AttrDefaultEntryHolder.defaultEntry);
        }
        return attr_;
      }
      private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
      internalGetMutableAttr() {
        onChanged();;
        if (attr_ == null) {
          attr_ = com.google.protobuf.MapField.newMapField(
              AttrDefaultEntryHolder.defaultEntry);
        }
        if (!attr_.isMutable()) {
          attr_ = attr_.copy();
        }
        return attr_;
      }

      public int getAttrCount() {
        return internalGetAttr().getMap().size();
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public boolean containsAttr(
          java.lang.String key) {
        if (key == null) { throw new java.lang.NullPointerException(); }
        return internalGetAttr().getMap().containsKey(key);
      }
      /**
       * Use {@link #getAttrMap()} instead.
       */
      @java.lang.Deprecated
      public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttr() {
        return getAttrMap();
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttrMap() {
        return internalGetAttr().getMap();
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public org.tensorflow.proto.framework.AttrValue getAttrOrDefault(
          java.lang.String key,
          org.tensorflow.proto.framework.AttrValue defaultValue) {
        if (key == null) { throw new java.lang.NullPointerException(); }
        java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
            internalGetAttr().getMap();
        return map.containsKey(key) ? map.get(key) : defaultValue;
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public org.tensorflow.proto.framework.AttrValue getAttrOrThrow(
          java.lang.String key) {
        if (key == null) { throw new java.lang.NullPointerException(); }
        java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
            internalGetAttr().getMap();
        if (!map.containsKey(key)) {
          throw new java.lang.IllegalArgumentException();
        }
        return map.get(key);
      }

      public Builder clearAttr() {
        internalGetMutableAttr().getMutableMap()
            .clear();
        return this;
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public Builder removeAttr(
          java.lang.String key) {
        if (key == null) { throw new java.lang.NullPointerException(); }
        internalGetMutableAttr().getMutableMap()
            .remove(key);
        return this;
      }
      /**
       * Use alternate mutation accessors instead.
       */
      @java.lang.Deprecated
      public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue>
      getMutableAttr() {
        return internalGetMutableAttr().getMutableMap();
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */
      public Builder putAttr(
          java.lang.String key,
          org.tensorflow.proto.framework.AttrValue value) {
        if (key == null) { throw new java.lang.NullPointerException(); }
        if (value == null) { throw new java.lang.NullPointerException(); }
        internalGetMutableAttr().getMutableMap()
            .put(key, value);
        return this;
      }
      /**
       * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 1;</code>
       */

      public Builder putAllAttr(
          java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> values) {
        internalGetMutableAttr().getMutableMap()
            .putAll(values);
        return this;
      }
      @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.FunctionDef.ArgAttrs)
    }

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

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

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

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

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

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

  }

  public static final int SIGNATURE_FIELD_NUMBER = 1;
  private org.tensorflow.proto.framework.OpDef signature_;
  /**
   * <pre>
   * The definition of the function's name, arguments, return values,
   * attrs etc.
   * </pre>
   *
   * <code>.tensorflow.OpDef signature = 1;</code>
   */
  public boolean hasSignature() {
    return signature_ != null;
  }
  /**
   * <pre>
   * The definition of the function's name, arguments, return values,
   * attrs etc.
   * </pre>
   *
   * <code>.tensorflow.OpDef signature = 1;</code>
   */
  public org.tensorflow.proto.framework.OpDef getSignature() {
    return signature_ == null ? org.tensorflow.proto.framework.OpDef.getDefaultInstance() : signature_;
  }
  /**
   * <pre>
   * The definition of the function's name, arguments, return values,
   * attrs etc.
   * </pre>
   *
   * <code>.tensorflow.OpDef signature = 1;</code>
   */
  public org.tensorflow.proto.framework.OpDefOrBuilder getSignatureOrBuilder() {
    return getSignature();
  }

  public static final int ATTR_FIELD_NUMBER = 5;
  private static final class AttrDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.String, org.tensorflow.proto.framework.AttrValue> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.String, org.tensorflow.proto.framework.AttrValue>newDefaultInstance(
                org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_AttrEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.MESSAGE,
                org.tensorflow.proto.framework.AttrValue.getDefaultInstance());
  }
  private com.google.protobuf.MapField<
      java.lang.String, org.tensorflow.proto.framework.AttrValue> attr_;
  private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
  internalGetAttr() {
    if (attr_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          AttrDefaultEntryHolder.defaultEntry);
    }
    return attr_;
  }

  public int getAttrCount() {
    return internalGetAttr().getMap().size();
  }
  /**
   * <pre>
   * Attributes specific to this function definition.
   * </pre>
   *
   * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
   */

  public boolean containsAttr(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetAttr().getMap().containsKey(key);
  }
  /**
   * Use {@link #getAttrMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttr() {
    return getAttrMap();
  }
  /**
   * <pre>
   * Attributes specific to this function definition.
   * </pre>
   *
   * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
   */

  public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttrMap() {
    return internalGetAttr().getMap();
  }
  /**
   * <pre>
   * Attributes specific to this function definition.
   * </pre>
   *
   * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
   */

  public org.tensorflow.proto.framework.AttrValue getAttrOrDefault(
      java.lang.String key,
      org.tensorflow.proto.framework.AttrValue defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
        internalGetAttr().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * Attributes specific to this function definition.
   * </pre>
   *
   * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
   */

  public org.tensorflow.proto.framework.AttrValue getAttrOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
        internalGetAttr().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int ARG_ATTR_FIELD_NUMBER = 7;
  private static final class ArgAttrDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>newDefaultInstance(
                org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ArgAttrEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.UINT32,
                0,
                com.google.protobuf.WireFormat.FieldType.MESSAGE,
                org.tensorflow.proto.framework.FunctionDef.ArgAttrs.getDefaultInstance());
  }
  private com.google.protobuf.MapField<
      java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> argAttr_;
  private com.google.protobuf.MapField<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
  internalGetArgAttr() {
    if (argAttr_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          ArgAttrDefaultEntryHolder.defaultEntry);
    }
    return argAttr_;
  }

  public int getArgAttrCount() {
    return internalGetArgAttr().getMap().size();
  }
  /**
   * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
   */

  public boolean containsArgAttr(
      int key) {
    
    return internalGetArgAttr().getMap().containsKey(key);
  }
  /**
   * Use {@link #getArgAttrMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> getArgAttr() {
    return getArgAttrMap();
  }
  /**
   * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
   */

  public java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> getArgAttrMap() {
    return internalGetArgAttr().getMap();
  }
  /**
   * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
   */

  public org.tensorflow.proto.framework.FunctionDef.ArgAttrs getArgAttrOrDefault(
      int key,
      org.tensorflow.proto.framework.FunctionDef.ArgAttrs defaultValue) {
    
    java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> map =
        internalGetArgAttr().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
   */

  public org.tensorflow.proto.framework.FunctionDef.ArgAttrs getArgAttrOrThrow(
      int key) {
    
    java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> map =
        internalGetArgAttr().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int RESOURCE_ARG_UNIQUE_ID_FIELD_NUMBER = 8;
  private static final class ResourceArgUniqueIdDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.Integer, java.lang.Integer> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.Integer, java.lang.Integer>newDefaultInstance(
                org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ResourceArgUniqueIdEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.UINT32,
                0,
                com.google.protobuf.WireFormat.FieldType.UINT32,
                0);
  }
  private com.google.protobuf.MapField<
      java.lang.Integer, java.lang.Integer> resourceArgUniqueId_;
  private com.google.protobuf.MapField<java.lang.Integer, java.lang.Integer>
  internalGetResourceArgUniqueId() {
    if (resourceArgUniqueId_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          ResourceArgUniqueIdDefaultEntryHolder.defaultEntry);
    }
    return resourceArgUniqueId_;
  }

  public int getResourceArgUniqueIdCount() {
    return internalGetResourceArgUniqueId().getMap().size();
  }
  /**
   * <pre>
   * Unique IDs for each resource argument, used to track aliasing resources. If
   * Argument A and Argument B alias each other, then
   * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
   * If this field is empty, none of the arguments could alias; otherwise, every
   * resource argument should have an entry in this field.
   * When instantiated, the unique IDs will be attached to the _Arg nodes'
   * "_resource_arg_unique_id" attribute.
   * </pre>
   *
   * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
   */

  public boolean containsResourceArgUniqueId(
      int key) {
    
    return internalGetResourceArgUniqueId().getMap().containsKey(key);
  }
  /**
   * Use {@link #getResourceArgUniqueIdMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.Integer, java.lang.Integer> getResourceArgUniqueId() {
    return getResourceArgUniqueIdMap();
  }
  /**
   * <pre>
   * Unique IDs for each resource argument, used to track aliasing resources. If
   * Argument A and Argument B alias each other, then
   * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
   * If this field is empty, none of the arguments could alias; otherwise, every
   * resource argument should have an entry in this field.
   * When instantiated, the unique IDs will be attached to the _Arg nodes'
   * "_resource_arg_unique_id" attribute.
   * </pre>
   *
   * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
   */

  public java.util.Map<java.lang.Integer, java.lang.Integer> getResourceArgUniqueIdMap() {
    return internalGetResourceArgUniqueId().getMap();
  }
  /**
   * <pre>
   * Unique IDs for each resource argument, used to track aliasing resources. If
   * Argument A and Argument B alias each other, then
   * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
   * If this field is empty, none of the arguments could alias; otherwise, every
   * resource argument should have an entry in this field.
   * When instantiated, the unique IDs will be attached to the _Arg nodes'
   * "_resource_arg_unique_id" attribute.
   * </pre>
   *
   * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
   */

  public int getResourceArgUniqueIdOrDefault(
      int key,
      int defaultValue) {
    
    java.util.Map<java.lang.Integer, java.lang.Integer> map =
        internalGetResourceArgUniqueId().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * Unique IDs for each resource argument, used to track aliasing resources. If
   * Argument A and Argument B alias each other, then
   * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
   * If this field is empty, none of the arguments could alias; otherwise, every
   * resource argument should have an entry in this field.
   * When instantiated, the unique IDs will be attached to the _Arg nodes'
   * "_resource_arg_unique_id" attribute.
   * </pre>
   *
   * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
   */

  public int getResourceArgUniqueIdOrThrow(
      int key) {
    
    java.util.Map<java.lang.Integer, java.lang.Integer> map =
        internalGetResourceArgUniqueId().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int NODE_DEF_FIELD_NUMBER = 3;
  private java.util.List<org.tensorflow.proto.framework.NodeDef> nodeDef_;
  /**
   * <pre>
   * By convention, "op" in node_def is resolved by consulting with a
   * user-defined library first. If not resolved, "func" is assumed to
   * be a builtin op.
   * </pre>
   *
   * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
   */
  public java.util.List<org.tensorflow.proto.framework.NodeDef> getNodeDefList() {
    return nodeDef_;
  }
  /**
   * <pre>
   * By convention, "op" in node_def is resolved by consulting with a
   * user-defined library first. If not resolved, "func" is assumed to
   * be a builtin op.
   * </pre>
   *
   * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.framework.NodeDefOrBuilder> 
      getNodeDefOrBuilderList() {
    return nodeDef_;
  }
  /**
   * <pre>
   * By convention, "op" in node_def is resolved by consulting with a
   * user-defined library first. If not resolved, "func" is assumed to
   * be a builtin op.
   * </pre>
   *
   * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
   */
  public int getNodeDefCount() {
    return nodeDef_.size();
  }
  /**
   * <pre>
   * By convention, "op" in node_def is resolved by consulting with a
   * user-defined library first. If not resolved, "func" is assumed to
   * be a builtin op.
   * </pre>
   *
   * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
   */
  public org.tensorflow.proto.framework.NodeDef getNodeDef(int index) {
    return nodeDef_.get(index);
  }
  /**
   * <pre>
   * By convention, "op" in node_def is resolved by consulting with a
   * user-defined library first. If not resolved, "func" is assumed to
   * be a builtin op.
   * </pre>
   *
   * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
   */
  public org.tensorflow.proto.framework.NodeDefOrBuilder getNodeDefOrBuilder(
      int index) {
    return nodeDef_.get(index);
  }

  public static final int RET_FIELD_NUMBER = 4;
  private static final class RetDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.String, java.lang.String> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.String, java.lang.String>newDefaultInstance(
                org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_RetEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.STRING,
                "");
  }
  private com.google.protobuf.MapField<
      java.lang.String, java.lang.String> ret_;
  private com.google.protobuf.MapField<java.lang.String, java.lang.String>
  internalGetRet() {
    if (ret_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          RetDefaultEntryHolder.defaultEntry);
    }
    return ret_;
  }

  public int getRetCount() {
    return internalGetRet().getMap().size();
  }
  /**
   * <pre>
   * A mapping from the output arg names from `signature` to the
   * outputs from `node_def` that should be returned by the function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; ret = 4;</code>
   */

  public boolean containsRet(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetRet().getMap().containsKey(key);
  }
  /**
   * Use {@link #getRetMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getRet() {
    return getRetMap();
  }
  /**
   * <pre>
   * A mapping from the output arg names from `signature` to the
   * outputs from `node_def` that should be returned by the function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; ret = 4;</code>
   */

  public java.util.Map<java.lang.String, java.lang.String> getRetMap() {
    return internalGetRet().getMap();
  }
  /**
   * <pre>
   * A mapping from the output arg names from `signature` to the
   * outputs from `node_def` that should be returned by the function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; ret = 4;</code>
   */

  public java.lang.String getRetOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetRet().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * A mapping from the output arg names from `signature` to the
   * outputs from `node_def` that should be returned by the function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; ret = 4;</code>
   */

  public java.lang.String getRetOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetRet().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int CONTROL_RET_FIELD_NUMBER = 6;
  private static final class ControlRetDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
        java.lang.String, java.lang.String> defaultEntry =
            com.google.protobuf.MapEntry
            .<java.lang.String, java.lang.String>newDefaultInstance(
                org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_ControlRetEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.STRING,
                "");
  }
  private com.google.protobuf.MapField<
      java.lang.String, java.lang.String> controlRet_;
  private com.google.protobuf.MapField<java.lang.String, java.lang.String>
  internalGetControlRet() {
    if (controlRet_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          ControlRetDefaultEntryHolder.defaultEntry);
    }
    return controlRet_;
  }

  public int getControlRetCount() {
    return internalGetControlRet().getMap().size();
  }
  /**
   * <pre>
   * A mapping from control output names from `signature` to node names in
   * `node_def` which should be control outputs of this function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; control_ret = 6;</code>
   */

  public boolean containsControlRet(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetControlRet().getMap().containsKey(key);
  }
  /**
   * Use {@link #getControlRetMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getControlRet() {
    return getControlRetMap();
  }
  /**
   * <pre>
   * A mapping from control output names from `signature` to node names in
   * `node_def` which should be control outputs of this function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; control_ret = 6;</code>
   */

  public java.util.Map<java.lang.String, java.lang.String> getControlRetMap() {
    return internalGetControlRet().getMap();
  }
  /**
   * <pre>
   * A mapping from control output names from `signature` to node names in
   * `node_def` which should be control outputs of this function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; control_ret = 6;</code>
   */

  public java.lang.String getControlRetOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetControlRet().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * A mapping from control output names from `signature` to node names in
   * `node_def` which should be control outputs of this function.
   * </pre>
   *
   * <code>map&lt;string, string&gt; control_ret = 6;</code>
   */

  public java.lang.String getControlRetOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetControlRet().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  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 {
    if (signature_ != null) {
      output.writeMessage(1, getSignature());
    }
    for (int i = 0; i < nodeDef_.size(); i++) {
      output.writeMessage(3, nodeDef_.get(i));
    }
    com.google.protobuf.GeneratedMessageV3
      .serializeStringMapTo(
        output,
        internalGetRet(),
        RetDefaultEntryHolder.defaultEntry,
        4);
    com.google.protobuf.GeneratedMessageV3
      .serializeStringMapTo(
        output,
        internalGetAttr(),
        AttrDefaultEntryHolder.defaultEntry,
        5);
    com.google.protobuf.GeneratedMessageV3
      .serializeStringMapTo(
        output,
        internalGetControlRet(),
        ControlRetDefaultEntryHolder.defaultEntry,
        6);
    com.google.protobuf.GeneratedMessageV3
      .serializeIntegerMapTo(
        output,
        internalGetArgAttr(),
        ArgAttrDefaultEntryHolder.defaultEntry,
        7);
    com.google.protobuf.GeneratedMessageV3
      .serializeIntegerMapTo(
        output,
        internalGetResourceArgUniqueId(),
        ResourceArgUniqueIdDefaultEntryHolder.defaultEntry,
        8);
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (signature_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, getSignature());
    }
    for (int i = 0; i < nodeDef_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, nodeDef_.get(i));
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry
         : internalGetRet().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
      ret__ = RetDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(4, ret__);
    }
    for (java.util.Map.Entry<java.lang.String, org.tensorflow.proto.framework.AttrValue> entry
         : internalGetAttr().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, org.tensorflow.proto.framework.AttrValue>
      attr__ = AttrDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(5, attr__);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry
         : internalGetControlRet().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
      controlRet__ = ControlRetDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(6, controlRet__);
    }
    for (java.util.Map.Entry<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> entry
         : internalGetArgAttr().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
      argAttr__ = ArgAttrDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(7, argAttr__);
    }
    for (java.util.Map.Entry<java.lang.Integer, java.lang.Integer> entry
         : internalGetResourceArgUniqueId().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.Integer, java.lang.Integer>
      resourceArgUniqueId__ = ResourceArgUniqueIdDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(8, resourceArgUniqueId__);
    }
    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.FunctionDef)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.framework.FunctionDef other = (org.tensorflow.proto.framework.FunctionDef) obj;

    if (hasSignature() != other.hasSignature()) return false;
    if (hasSignature()) {
      if (!getSignature()
          .equals(other.getSignature())) return false;
    }
    if (!internalGetAttr().equals(
        other.internalGetAttr())) return false;
    if (!internalGetArgAttr().equals(
        other.internalGetArgAttr())) return false;
    if (!internalGetResourceArgUniqueId().equals(
        other.internalGetResourceArgUniqueId())) return false;
    if (!getNodeDefList()
        .equals(other.getNodeDefList())) return false;
    if (!internalGetRet().equals(
        other.internalGetRet())) return false;
    if (!internalGetControlRet().equals(
        other.internalGetControlRet())) 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 (hasSignature()) {
      hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
      hash = (53 * hash) + getSignature().hashCode();
    }
    if (!internalGetAttr().getMap().isEmpty()) {
      hash = (37 * hash) + ATTR_FIELD_NUMBER;
      hash = (53 * hash) + internalGetAttr().hashCode();
    }
    if (!internalGetArgAttr().getMap().isEmpty()) {
      hash = (37 * hash) + ARG_ATTR_FIELD_NUMBER;
      hash = (53 * hash) + internalGetArgAttr().hashCode();
    }
    if (!internalGetResourceArgUniqueId().getMap().isEmpty()) {
      hash = (37 * hash) + RESOURCE_ARG_UNIQUE_ID_FIELD_NUMBER;
      hash = (53 * hash) + internalGetResourceArgUniqueId().hashCode();
    }
    if (getNodeDefCount() > 0) {
      hash = (37 * hash) + NODE_DEF_FIELD_NUMBER;
      hash = (53 * hash) + getNodeDefList().hashCode();
    }
    if (!internalGetRet().getMap().isEmpty()) {
      hash = (37 * hash) + RET_FIELD_NUMBER;
      hash = (53 * hash) + internalGetRet().hashCode();
    }
    if (!internalGetControlRet().getMap().isEmpty()) {
      hash = (37 * hash) + CONTROL_RET_FIELD_NUMBER;
      hash = (53 * hash) + internalGetControlRet().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.framework.FunctionDef parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDef 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.FunctionDef parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDef 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.FunctionDef parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.FunctionDef parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.FunctionDef parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDef 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.FunctionDef parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDef 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.FunctionDef parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.FunctionDef 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.FunctionDef 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 function can be instantiated when the runtime can bind every attr
   * with a value. When a GraphDef has a call to a function, it must
   * have binding for every attr defined in the signature.
   * TODO(zhifengc):
   *   * device spec, etc.
   * </pre>
   *
   * Protobuf type {@code tensorflow.FunctionDef}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.FunctionDef)
      org.tensorflow.proto.framework.FunctionDefOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(
        int number) {
      switch (number) {
        case 5:
          return internalGetAttr();
        case 7:
          return internalGetArgAttr();
        case 8:
          return internalGetResourceArgUniqueId();
        case 4:
          return internalGetRet();
        case 6:
          return internalGetControlRet();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(
        int number) {
      switch (number) {
        case 5:
          return internalGetMutableAttr();
        case 7:
          return internalGetMutableArgAttr();
        case 8:
          return internalGetMutableResourceArgUniqueId();
        case 4:
          return internalGetMutableRet();
        case 6:
          return internalGetMutableControlRet();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.framework.FunctionProtos.internal_static_tensorflow_FunctionDef_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.framework.FunctionDef.class, org.tensorflow.proto.framework.FunctionDef.Builder.class);
    }

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

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getNodeDefFieldBuilder();
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (signatureBuilder_ == null) {
        signature_ = null;
      } else {
        signature_ = null;
        signatureBuilder_ = null;
      }
      internalGetMutableAttr().clear();
      internalGetMutableArgAttr().clear();
      internalGetMutableResourceArgUniqueId().clear();
      if (nodeDefBuilder_ == null) {
        nodeDef_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000008);
      } else {
        nodeDefBuilder_.clear();
      }
      internalGetMutableRet().clear();
      internalGetMutableControlRet().clear();
      return this;
    }

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

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

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

    @java.lang.Override
    public org.tensorflow.proto.framework.FunctionDef buildPartial() {
      org.tensorflow.proto.framework.FunctionDef result = new org.tensorflow.proto.framework.FunctionDef(this);
      int from_bitField0_ = bitField0_;
      if (signatureBuilder_ == null) {
        result.signature_ = signature_;
      } else {
        result.signature_ = signatureBuilder_.build();
      }
      result.attr_ = internalGetAttr();
      result.attr_.makeImmutable();
      result.argAttr_ = internalGetArgAttr();
      result.argAttr_.makeImmutable();
      result.resourceArgUniqueId_ = internalGetResourceArgUniqueId();
      result.resourceArgUniqueId_.makeImmutable();
      if (nodeDefBuilder_ == null) {
        if (((bitField0_ & 0x00000008) != 0)) {
          nodeDef_ = java.util.Collections.unmodifiableList(nodeDef_);
          bitField0_ = (bitField0_ & ~0x00000008);
        }
        result.nodeDef_ = nodeDef_;
      } else {
        result.nodeDef_ = nodeDefBuilder_.build();
      }
      result.ret_ = internalGetRet();
      result.ret_.makeImmutable();
      result.controlRet_ = internalGetControlRet();
      result.controlRet_.makeImmutable();
      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.FunctionDef) {
        return mergeFrom((org.tensorflow.proto.framework.FunctionDef)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.framework.FunctionDef other) {
      if (other == org.tensorflow.proto.framework.FunctionDef.getDefaultInstance()) return this;
      if (other.hasSignature()) {
        mergeSignature(other.getSignature());
      }
      internalGetMutableAttr().mergeFrom(
          other.internalGetAttr());
      internalGetMutableArgAttr().mergeFrom(
          other.internalGetArgAttr());
      internalGetMutableResourceArgUniqueId().mergeFrom(
          other.internalGetResourceArgUniqueId());
      if (nodeDefBuilder_ == null) {
        if (!other.nodeDef_.isEmpty()) {
          if (nodeDef_.isEmpty()) {
            nodeDef_ = other.nodeDef_;
            bitField0_ = (bitField0_ & ~0x00000008);
          } else {
            ensureNodeDefIsMutable();
            nodeDef_.addAll(other.nodeDef_);
          }
          onChanged();
        }
      } else {
        if (!other.nodeDef_.isEmpty()) {
          if (nodeDefBuilder_.isEmpty()) {
            nodeDefBuilder_.dispose();
            nodeDefBuilder_ = null;
            nodeDef_ = other.nodeDef_;
            bitField0_ = (bitField0_ & ~0x00000008);
            nodeDefBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getNodeDefFieldBuilder() : null;
          } else {
            nodeDefBuilder_.addAllMessages(other.nodeDef_);
          }
        }
      }
      internalGetMutableRet().mergeFrom(
          other.internalGetRet());
      internalGetMutableControlRet().mergeFrom(
          other.internalGetControlRet());
      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.FunctionDef parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.framework.FunctionDef) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private org.tensorflow.proto.framework.OpDef signature_;
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.proto.framework.OpDef, org.tensorflow.proto.framework.OpDef.Builder, org.tensorflow.proto.framework.OpDefOrBuilder> signatureBuilder_;
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public boolean hasSignature() {
      return signatureBuilder_ != null || signature_ != null;
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public org.tensorflow.proto.framework.OpDef getSignature() {
      if (signatureBuilder_ == null) {
        return signature_ == null ? org.tensorflow.proto.framework.OpDef.getDefaultInstance() : signature_;
      } else {
        return signatureBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public Builder setSignature(org.tensorflow.proto.framework.OpDef value) {
      if (signatureBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        signature_ = value;
        onChanged();
      } else {
        signatureBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public Builder setSignature(
        org.tensorflow.proto.framework.OpDef.Builder builderForValue) {
      if (signatureBuilder_ == null) {
        signature_ = builderForValue.build();
        onChanged();
      } else {
        signatureBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public Builder mergeSignature(org.tensorflow.proto.framework.OpDef value) {
      if (signatureBuilder_ == null) {
        if (signature_ != null) {
          signature_ =
            org.tensorflow.proto.framework.OpDef.newBuilder(signature_).mergeFrom(value).buildPartial();
        } else {
          signature_ = value;
        }
        onChanged();
      } else {
        signatureBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public Builder clearSignature() {
      if (signatureBuilder_ == null) {
        signature_ = null;
        onChanged();
      } else {
        signature_ = null;
        signatureBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public org.tensorflow.proto.framework.OpDef.Builder getSignatureBuilder() {
      
      onChanged();
      return getSignatureFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    public org.tensorflow.proto.framework.OpDefOrBuilder getSignatureOrBuilder() {
      if (signatureBuilder_ != null) {
        return signatureBuilder_.getMessageOrBuilder();
      } else {
        return signature_ == null ?
            org.tensorflow.proto.framework.OpDef.getDefaultInstance() : signature_;
      }
    }
    /**
     * <pre>
     * The definition of the function's name, arguments, return values,
     * attrs etc.
     * </pre>
     *
     * <code>.tensorflow.OpDef signature = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.proto.framework.OpDef, org.tensorflow.proto.framework.OpDef.Builder, org.tensorflow.proto.framework.OpDefOrBuilder> 
        getSignatureFieldBuilder() {
      if (signatureBuilder_ == null) {
        signatureBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            org.tensorflow.proto.framework.OpDef, org.tensorflow.proto.framework.OpDef.Builder, org.tensorflow.proto.framework.OpDefOrBuilder>(
                getSignature(),
                getParentForChildren(),
                isClean());
        signature_ = null;
      }
      return signatureBuilder_;
    }

    private com.google.protobuf.MapField<
        java.lang.String, org.tensorflow.proto.framework.AttrValue> attr_;
    private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    internalGetAttr() {
      if (attr_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            AttrDefaultEntryHolder.defaultEntry);
      }
      return attr_;
    }
    private com.google.protobuf.MapField<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    internalGetMutableAttr() {
      onChanged();;
      if (attr_ == null) {
        attr_ = com.google.protobuf.MapField.newMapField(
            AttrDefaultEntryHolder.defaultEntry);
      }
      if (!attr_.isMutable()) {
        attr_ = attr_.copy();
      }
      return attr_;
    }

    public int getAttrCount() {
      return internalGetAttr().getMap().size();
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public boolean containsAttr(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetAttr().getMap().containsKey(key);
    }
    /**
     * Use {@link #getAttrMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttr() {
      return getAttrMap();
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> getAttrMap() {
      return internalGetAttr().getMap();
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public org.tensorflow.proto.framework.AttrValue getAttrOrDefault(
        java.lang.String key,
        org.tensorflow.proto.framework.AttrValue defaultValue) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
          internalGetAttr().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public org.tensorflow.proto.framework.AttrValue getAttrOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> map =
          internalGetAttr().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearAttr() {
      internalGetMutableAttr().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public Builder removeAttr(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableAttr().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue>
    getMutableAttr() {
      return internalGetMutableAttr().getMutableMap();
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */
    public Builder putAttr(
        java.lang.String key,
        org.tensorflow.proto.framework.AttrValue value) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableAttr().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * Attributes specific to this function definition.
     * </pre>
     *
     * <code>map&lt;string, .tensorflow.AttrValue&gt; attr = 5;</code>
     */

    public Builder putAllAttr(
        java.util.Map<java.lang.String, org.tensorflow.proto.framework.AttrValue> values) {
      internalGetMutableAttr().getMutableMap()
          .putAll(values);
      return this;
    }

    private com.google.protobuf.MapField<
        java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> argAttr_;
    private com.google.protobuf.MapField<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
    internalGetArgAttr() {
      if (argAttr_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            ArgAttrDefaultEntryHolder.defaultEntry);
      }
      return argAttr_;
    }
    private com.google.protobuf.MapField<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
    internalGetMutableArgAttr() {
      onChanged();;
      if (argAttr_ == null) {
        argAttr_ = com.google.protobuf.MapField.newMapField(
            ArgAttrDefaultEntryHolder.defaultEntry);
      }
      if (!argAttr_.isMutable()) {
        argAttr_ = argAttr_.copy();
      }
      return argAttr_;
    }

    public int getArgAttrCount() {
      return internalGetArgAttr().getMap().size();
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public boolean containsArgAttr(
        int key) {
      
      return internalGetArgAttr().getMap().containsKey(key);
    }
    /**
     * Use {@link #getArgAttrMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> getArgAttr() {
      return getArgAttrMap();
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> getArgAttrMap() {
      return internalGetArgAttr().getMap();
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public org.tensorflow.proto.framework.FunctionDef.ArgAttrs getArgAttrOrDefault(
        int key,
        org.tensorflow.proto.framework.FunctionDef.ArgAttrs defaultValue) {
      
      java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> map =
          internalGetArgAttr().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public org.tensorflow.proto.framework.FunctionDef.ArgAttrs getArgAttrOrThrow(
        int key) {
      
      java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> map =
          internalGetArgAttr().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearArgAttr() {
      internalGetMutableArgAttr().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public Builder removeArgAttr(
        int key) {
      
      internalGetMutableArgAttr().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs>
    getMutableArgAttr() {
      return internalGetMutableArgAttr().getMutableMap();
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */
    public Builder putArgAttr(
        int key,
        org.tensorflow.proto.framework.FunctionDef.ArgAttrs value) {
      
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableArgAttr().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <code>map&lt;uint32, .tensorflow.FunctionDef.ArgAttrs&gt; arg_attr = 7;</code>
     */

    public Builder putAllArgAttr(
        java.util.Map<java.lang.Integer, org.tensorflow.proto.framework.FunctionDef.ArgAttrs> values) {
      internalGetMutableArgAttr().getMutableMap()
          .putAll(values);
      return this;
    }

    private com.google.protobuf.MapField<
        java.lang.Integer, java.lang.Integer> resourceArgUniqueId_;
    private com.google.protobuf.MapField<java.lang.Integer, java.lang.Integer>
    internalGetResourceArgUniqueId() {
      if (resourceArgUniqueId_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            ResourceArgUniqueIdDefaultEntryHolder.defaultEntry);
      }
      return resourceArgUniqueId_;
    }
    private com.google.protobuf.MapField<java.lang.Integer, java.lang.Integer>
    internalGetMutableResourceArgUniqueId() {
      onChanged();;
      if (resourceArgUniqueId_ == null) {
        resourceArgUniqueId_ = com.google.protobuf.MapField.newMapField(
            ResourceArgUniqueIdDefaultEntryHolder.defaultEntry);
      }
      if (!resourceArgUniqueId_.isMutable()) {
        resourceArgUniqueId_ = resourceArgUniqueId_.copy();
      }
      return resourceArgUniqueId_;
    }

    public int getResourceArgUniqueIdCount() {
      return internalGetResourceArgUniqueId().getMap().size();
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public boolean containsResourceArgUniqueId(
        int key) {
      
      return internalGetResourceArgUniqueId().getMap().containsKey(key);
    }
    /**
     * Use {@link #getResourceArgUniqueIdMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.Integer, java.lang.Integer> getResourceArgUniqueId() {
      return getResourceArgUniqueIdMap();
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public java.util.Map<java.lang.Integer, java.lang.Integer> getResourceArgUniqueIdMap() {
      return internalGetResourceArgUniqueId().getMap();
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public int getResourceArgUniqueIdOrDefault(
        int key,
        int defaultValue) {
      
      java.util.Map<java.lang.Integer, java.lang.Integer> map =
          internalGetResourceArgUniqueId().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public int getResourceArgUniqueIdOrThrow(
        int key) {
      
      java.util.Map<java.lang.Integer, java.lang.Integer> map =
          internalGetResourceArgUniqueId().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearResourceArgUniqueId() {
      internalGetMutableResourceArgUniqueId().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public Builder removeResourceArgUniqueId(
        int key) {
      
      internalGetMutableResourceArgUniqueId().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.Integer, java.lang.Integer>
    getMutableResourceArgUniqueId() {
      return internalGetMutableResourceArgUniqueId().getMutableMap();
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */
    public Builder putResourceArgUniqueId(
        int key,
        int value) {
      
      
      internalGetMutableResourceArgUniqueId().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * Unique IDs for each resource argument, used to track aliasing resources. If
     * Argument A and Argument B alias each other, then
     * resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
     * If this field is empty, none of the arguments could alias; otherwise, every
     * resource argument should have an entry in this field.
     * When instantiated, the unique IDs will be attached to the _Arg nodes'
     * "_resource_arg_unique_id" attribute.
     * </pre>
     *
     * <code>map&lt;uint32, uint32&gt; resource_arg_unique_id = 8;</code>
     */

    public Builder putAllResourceArgUniqueId(
        java.util.Map<java.lang.Integer, java.lang.Integer> values) {
      internalGetMutableResourceArgUniqueId().getMutableMap()
          .putAll(values);
      return this;
    }

    private java.util.List<org.tensorflow.proto.framework.NodeDef> nodeDef_ =
      java.util.Collections.emptyList();
    private void ensureNodeDefIsMutable() {
      if (!((bitField0_ & 0x00000008) != 0)) {
        nodeDef_ = new java.util.ArrayList<org.tensorflow.proto.framework.NodeDef>(nodeDef_);
        bitField0_ |= 0x00000008;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.NodeDef, org.tensorflow.proto.framework.NodeDef.Builder, org.tensorflow.proto.framework.NodeDefOrBuilder> nodeDefBuilder_;

    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.NodeDef> getNodeDefList() {
      if (nodeDefBuilder_ == null) {
        return java.util.Collections.unmodifiableList(nodeDef_);
      } else {
        return nodeDefBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public int getNodeDefCount() {
      if (nodeDefBuilder_ == null) {
        return nodeDef_.size();
      } else {
        return nodeDefBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public org.tensorflow.proto.framework.NodeDef getNodeDef(int index) {
      if (nodeDefBuilder_ == null) {
        return nodeDef_.get(index);
      } else {
        return nodeDefBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder setNodeDef(
        int index, org.tensorflow.proto.framework.NodeDef value) {
      if (nodeDefBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeDefIsMutable();
        nodeDef_.set(index, value);
        onChanged();
      } else {
        nodeDefBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder setNodeDef(
        int index, org.tensorflow.proto.framework.NodeDef.Builder builderForValue) {
      if (nodeDefBuilder_ == null) {
        ensureNodeDefIsMutable();
        nodeDef_.set(index, builderForValue.build());
        onChanged();
      } else {
        nodeDefBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder addNodeDef(org.tensorflow.proto.framework.NodeDef value) {
      if (nodeDefBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeDefIsMutable();
        nodeDef_.add(value);
        onChanged();
      } else {
        nodeDefBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder addNodeDef(
        int index, org.tensorflow.proto.framework.NodeDef value) {
      if (nodeDefBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeDefIsMutable();
        nodeDef_.add(index, value);
        onChanged();
      } else {
        nodeDefBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder addNodeDef(
        org.tensorflow.proto.framework.NodeDef.Builder builderForValue) {
      if (nodeDefBuilder_ == null) {
        ensureNodeDefIsMutable();
        nodeDef_.add(builderForValue.build());
        onChanged();
      } else {
        nodeDefBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder addNodeDef(
        int index, org.tensorflow.proto.framework.NodeDef.Builder builderForValue) {
      if (nodeDefBuilder_ == null) {
        ensureNodeDefIsMutable();
        nodeDef_.add(index, builderForValue.build());
        onChanged();
      } else {
        nodeDefBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder addAllNodeDef(
        java.lang.Iterable<? extends org.tensorflow.proto.framework.NodeDef> values) {
      if (nodeDefBuilder_ == null) {
        ensureNodeDefIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, nodeDef_);
        onChanged();
      } else {
        nodeDefBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder clearNodeDef() {
      if (nodeDefBuilder_ == null) {
        nodeDef_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000008);
        onChanged();
      } else {
        nodeDefBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public Builder removeNodeDef(int index) {
      if (nodeDefBuilder_ == null) {
        ensureNodeDefIsMutable();
        nodeDef_.remove(index);
        onChanged();
      } else {
        nodeDefBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public org.tensorflow.proto.framework.NodeDef.Builder getNodeDefBuilder(
        int index) {
      return getNodeDefFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public org.tensorflow.proto.framework.NodeDefOrBuilder getNodeDefOrBuilder(
        int index) {
      if (nodeDefBuilder_ == null) {
        return nodeDef_.get(index);  } else {
        return nodeDefBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.framework.NodeDefOrBuilder> 
         getNodeDefOrBuilderList() {
      if (nodeDefBuilder_ != null) {
        return nodeDefBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(nodeDef_);
      }
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public org.tensorflow.proto.framework.NodeDef.Builder addNodeDefBuilder() {
      return getNodeDefFieldBuilder().addBuilder(
          org.tensorflow.proto.framework.NodeDef.getDefaultInstance());
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public org.tensorflow.proto.framework.NodeDef.Builder addNodeDefBuilder(
        int index) {
      return getNodeDefFieldBuilder().addBuilder(
          index, org.tensorflow.proto.framework.NodeDef.getDefaultInstance());
    }
    /**
     * <pre>
     * By convention, "op" in node_def is resolved by consulting with a
     * user-defined library first. If not resolved, "func" is assumed to
     * be a builtin op.
     * </pre>
     *
     * <code>repeated .tensorflow.NodeDef node_def = 3;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.NodeDef.Builder> 
         getNodeDefBuilderList() {
      return getNodeDefFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.NodeDef, org.tensorflow.proto.framework.NodeDef.Builder, org.tensorflow.proto.framework.NodeDefOrBuilder> 
        getNodeDefFieldBuilder() {
      if (nodeDefBuilder_ == null) {
        nodeDefBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.framework.NodeDef, org.tensorflow.proto.framework.NodeDef.Builder, org.tensorflow.proto.framework.NodeDefOrBuilder>(
                nodeDef_,
                ((bitField0_ & 0x00000008) != 0),
                getParentForChildren(),
                isClean());
        nodeDef_ = null;
      }
      return nodeDefBuilder_;
    }

    private com.google.protobuf.MapField<
        java.lang.String, java.lang.String> ret_;
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetRet() {
      if (ret_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            RetDefaultEntryHolder.defaultEntry);
      }
      return ret_;
    }
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetMutableRet() {
      onChanged();;
      if (ret_ == null) {
        ret_ = com.google.protobuf.MapField.newMapField(
            RetDefaultEntryHolder.defaultEntry);
      }
      if (!ret_.isMutable()) {
        ret_ = ret_.copy();
      }
      return ret_;
    }

    public int getRetCount() {
      return internalGetRet().getMap().size();
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public boolean containsRet(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetRet().getMap().containsKey(key);
    }
    /**
     * Use {@link #getRetMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getRet() {
      return getRetMap();
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public java.util.Map<java.lang.String, java.lang.String> getRetMap() {
      return internalGetRet().getMap();
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public java.lang.String getRetOrDefault(
        java.lang.String key,
        java.lang.String defaultValue) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetRet().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public java.lang.String getRetOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetRet().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearRet() {
      internalGetMutableRet().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public Builder removeRet(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableRet().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String>
    getMutableRet() {
      return internalGetMutableRet().getMutableMap();
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */
    public Builder putRet(
        java.lang.String key,
        java.lang.String value) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableRet().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * A mapping from the output arg names from `signature` to the
     * outputs from `node_def` that should be returned by the function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; ret = 4;</code>
     */

    public Builder putAllRet(
        java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableRet().getMutableMap()
          .putAll(values);
      return this;
    }

    private com.google.protobuf.MapField<
        java.lang.String, java.lang.String> controlRet_;
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetControlRet() {
      if (controlRet_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            ControlRetDefaultEntryHolder.defaultEntry);
      }
      return controlRet_;
    }
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetMutableControlRet() {
      onChanged();;
      if (controlRet_ == null) {
        controlRet_ = com.google.protobuf.MapField.newMapField(
            ControlRetDefaultEntryHolder.defaultEntry);
      }
      if (!controlRet_.isMutable()) {
        controlRet_ = controlRet_.copy();
      }
      return controlRet_;
    }

    public int getControlRetCount() {
      return internalGetControlRet().getMap().size();
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public boolean containsControlRet(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetControlRet().getMap().containsKey(key);
    }
    /**
     * Use {@link #getControlRetMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getControlRet() {
      return getControlRetMap();
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public java.util.Map<java.lang.String, java.lang.String> getControlRetMap() {
      return internalGetControlRet().getMap();
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public java.lang.String getControlRetOrDefault(
        java.lang.String key,
        java.lang.String defaultValue) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetControlRet().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public java.lang.String getControlRetOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetControlRet().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearControlRet() {
      internalGetMutableControlRet().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public Builder removeControlRet(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableControlRet().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String>
    getMutableControlRet() {
      return internalGetMutableControlRet().getMutableMap();
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */
    public Builder putControlRet(
        java.lang.String key,
        java.lang.String value) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableControlRet().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * A mapping from control output names from `signature` to node names in
     * `node_def` which should be control outputs of this function.
     * </pre>
     *
     * <code>map&lt;string, string&gt; control_ret = 6;</code>
     */

    public Builder putAllControlRet(
        java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableControlRet().getMutableMap()
          .putAll(values);
      return this;
    }
    @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.FunctionDef)
  }

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

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

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

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

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

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

}

