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

package org.tensorflow.proto.framework;

/**
 * <pre>
 * Dimensions of a tensor.
 * </pre>
 *
 * Protobuf type {@code tensorflow.TensorShapeProto}
 */
public  final class TensorShapeProto extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.TensorShapeProto)
    TensorShapeProtoOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TensorShapeProto.newBuilder() to construct.
  private TensorShapeProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private TensorShapeProto() {
    dim_ = java.util.Collections.emptyList();
  }

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

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private TensorShapeProto(
      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 18: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              dim_ = new java.util.ArrayList<org.tensorflow.proto.framework.TensorShapeProto.Dim>();
              mutable_bitField0_ |= 0x00000001;
            }
            dim_.add(
                input.readMessage(org.tensorflow.proto.framework.TensorShapeProto.Dim.parser(), extensionRegistry));
            break;
          }
          case 24: {

            unknownRank_ = input.readBool();
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        dim_ = java.util.Collections.unmodifiableList(dim_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.proto.framework.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_descriptor;
  }

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

  public interface DimOrBuilder extends
      // @@protoc_insertion_point(interface_extends:tensorflow.TensorShapeProto.Dim)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <pre>
     * Size of the tensor in that dimension.
     * This value must be &gt;= -1, but values of -1 are reserved for "unknown"
     * shapes (values of -1 mean "unknown" dimension).  Certain wrappers
     * that work with TensorShapeProto may fail at runtime when deserializing
     * a TensorShapeProto containing a dim value of -1.
     * </pre>
     *
     * <code>int64 size = 1;</code>
     */
    long getSize();

    /**
     * <pre>
     * Optional name of the tensor dimension.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    java.lang.String getName();
    /**
     * <pre>
     * Optional name of the tensor dimension.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    com.google.protobuf.ByteString
        getNameBytes();
  }
  /**
   * <pre>
   * One dimension of the tensor.
   * </pre>
   *
   * Protobuf type {@code tensorflow.TensorShapeProto.Dim}
   */
  public  static final class Dim extends
      com.google.protobuf.GeneratedMessageV3 implements
      // @@protoc_insertion_point(message_implements:tensorflow.TensorShapeProto.Dim)
      DimOrBuilder {
  private static final long serialVersionUID = 0L;
    // Use Dim.newBuilder() to construct.
    private Dim(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }
    private Dim() {
      name_ = "";
    }

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

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
      return this.unknownFields;
    }
    private Dim(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      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 8: {

              size_ = input.readInt64();
              break;
            }
            case 18: {
              java.lang.String s = input.readStringRequireUtf8();

              name_ = s;
              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.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_Dim_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.proto.framework.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_Dim_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.proto.framework.TensorShapeProto.Dim.class, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder.class);
    }

    public static final int SIZE_FIELD_NUMBER = 1;
    private long size_;
    /**
     * <pre>
     * Size of the tensor in that dimension.
     * This value must be &gt;= -1, but values of -1 are reserved for "unknown"
     * shapes (values of -1 mean "unknown" dimension).  Certain wrappers
     * that work with TensorShapeProto may fail at runtime when deserializing
     * a TensorShapeProto containing a dim value of -1.
     * </pre>
     *
     * <code>int64 size = 1;</code>
     */
    public long getSize() {
      return size_;
    }

    public static final int NAME_FIELD_NUMBER = 2;
    private volatile java.lang.Object name_;
    /**
     * <pre>
     * Optional name of the tensor dimension.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      }
    }
    /**
     * <pre>
     * Optional name of the tensor dimension.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public com.google.protobuf.ByteString
        getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    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 (size_ != 0L) {
        output.writeInt64(1, size_);
      }
      if (!getNameBytes().isEmpty()) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
      }
      unknownFields.writeTo(output);
    }

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

      size = 0;
      if (size_ != 0L) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(1, size_);
      }
      if (!getNameBytes().isEmpty()) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_);
      }
      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.TensorShapeProto.Dim)) {
        return super.equals(obj);
      }
      org.tensorflow.proto.framework.TensorShapeProto.Dim other = (org.tensorflow.proto.framework.TensorShapeProto.Dim) obj;

      if (getSize()
          != other.getSize()) return false;
      if (!getName()
          .equals(other.getName())) 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();
      hash = (37 * hash) + SIZE_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getSize());
      hash = (37 * hash) + NAME_FIELD_NUMBER;
      hash = (53 * hash) + getName().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static org.tensorflow.proto.framework.TensorShapeProto.Dim parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim 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.TensorShapeProto.Dim parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim 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.TensorShapeProto.Dim parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim 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.TensorShapeProto.Dim parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim 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.TensorShapeProto.Dim parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.tensorflow.proto.framework.TensorShapeProto.Dim 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.TensorShapeProto.Dim 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>
     * One dimension of the tensor.
     * </pre>
     *
     * Protobuf type {@code tensorflow.TensorShapeProto.Dim}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:tensorflow.TensorShapeProto.Dim)
        org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.tensorflow.proto.framework.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_Dim_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.tensorflow.proto.framework.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_Dim_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.tensorflow.proto.framework.TensorShapeProto.Dim.class, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder.class);
      }

      // Construct using org.tensorflow.proto.framework.TensorShapeProto.Dim.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();
        size_ = 0L;

        name_ = "";

        return this;
      }

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

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

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

      @java.lang.Override
      public org.tensorflow.proto.framework.TensorShapeProto.Dim buildPartial() {
        org.tensorflow.proto.framework.TensorShapeProto.Dim result = new org.tensorflow.proto.framework.TensorShapeProto.Dim(this);
        result.size_ = size_;
        result.name_ = name_;
        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.TensorShapeProto.Dim) {
          return mergeFrom((org.tensorflow.proto.framework.TensorShapeProto.Dim)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.tensorflow.proto.framework.TensorShapeProto.Dim other) {
        if (other == org.tensorflow.proto.framework.TensorShapeProto.Dim.getDefaultInstance()) return this;
        if (other.getSize() != 0L) {
          setSize(other.getSize());
        }
        if (!other.getName().isEmpty()) {
          name_ = other.name_;
          onChanged();
        }
        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.TensorShapeProto.Dim parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.tensorflow.proto.framework.TensorShapeProto.Dim) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }

      private long size_ ;
      /**
       * <pre>
       * Size of the tensor in that dimension.
       * This value must be &gt;= -1, but values of -1 are reserved for "unknown"
       * shapes (values of -1 mean "unknown" dimension).  Certain wrappers
       * that work with TensorShapeProto may fail at runtime when deserializing
       * a TensorShapeProto containing a dim value of -1.
       * </pre>
       *
       * <code>int64 size = 1;</code>
       */
      public long getSize() {
        return size_;
      }
      /**
       * <pre>
       * Size of the tensor in that dimension.
       * This value must be &gt;= -1, but values of -1 are reserved for "unknown"
       * shapes (values of -1 mean "unknown" dimension).  Certain wrappers
       * that work with TensorShapeProto may fail at runtime when deserializing
       * a TensorShapeProto containing a dim value of -1.
       * </pre>
       *
       * <code>int64 size = 1;</code>
       */
      public Builder setSize(long value) {
        
        size_ = value;
        onChanged();
        return this;
      }
      /**
       * <pre>
       * Size of the tensor in that dimension.
       * This value must be &gt;= -1, but values of -1 are reserved for "unknown"
       * shapes (values of -1 mean "unknown" dimension).  Certain wrappers
       * that work with TensorShapeProto may fail at runtime when deserializing
       * a TensorShapeProto containing a dim value of -1.
       * </pre>
       *
       * <code>int64 size = 1;</code>
       */
      public Builder clearSize() {
        
        size_ = 0L;
        onChanged();
        return this;
      }

      private java.lang.Object name_ = "";
      /**
       * <pre>
       * Optional name of the tensor dimension.
       * </pre>
       *
       * <code>string name = 2;</code>
       */
      public java.lang.String getName() {
        java.lang.Object ref = name_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          name_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <pre>
       * Optional name of the tensor dimension.
       * </pre>
       *
       * <code>string name = 2;</code>
       */
      public com.google.protobuf.ByteString
          getNameBytes() {
        java.lang.Object ref = name_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          name_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <pre>
       * Optional name of the tensor dimension.
       * </pre>
       *
       * <code>string name = 2;</code>
       */
      public Builder setName(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  
        name_ = value;
        onChanged();
        return this;
      }
      /**
       * <pre>
       * Optional name of the tensor dimension.
       * </pre>
       *
       * <code>string name = 2;</code>
       */
      public Builder clearName() {
        
        name_ = getDefaultInstance().getName();
        onChanged();
        return this;
      }
      /**
       * <pre>
       * Optional name of the tensor dimension.
       * </pre>
       *
       * <code>string name = 2;</code>
       */
      public Builder setNameBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
        
        name_ = value;
        onChanged();
        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.TensorShapeProto.Dim)
    }

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

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

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

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

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

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

  }

  public static final int DIM_FIELD_NUMBER = 2;
  private java.util.List<org.tensorflow.proto.framework.TensorShapeProto.Dim> dim_;
  /**
   * <pre>
   * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
   * for a 30 x 40 2D tensor.  If an entry has size -1, this
   * corresponds to a dimension of unknown size. The names are
   * optional.
   * The order of entries in "dim" matters: It indicates the layout of the
   * values in the tensor in-memory representation.
   * The first entry in "dim" is the outermost dimension used to layout the
   * values, the last entry is the innermost dimension.  This matches the
   * in-memory layout of RowMajor Eigen tensors.
   * If "dim.size()" &gt; 0, "unknown_rank" must be false.
   * </pre>
   *
   * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
   */
  public java.util.List<org.tensorflow.proto.framework.TensorShapeProto.Dim> getDimList() {
    return dim_;
  }
  /**
   * <pre>
   * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
   * for a 30 x 40 2D tensor.  If an entry has size -1, this
   * corresponds to a dimension of unknown size. The names are
   * optional.
   * The order of entries in "dim" matters: It indicates the layout of the
   * values in the tensor in-memory representation.
   * The first entry in "dim" is the outermost dimension used to layout the
   * values, the last entry is the innermost dimension.  This matches the
   * in-memory layout of RowMajor Eigen tensors.
   * If "dim.size()" &gt; 0, "unknown_rank" must be false.
   * </pre>
   *
   * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
   */
  public java.util.List<? extends org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder> 
      getDimOrBuilderList() {
    return dim_;
  }
  /**
   * <pre>
   * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
   * for a 30 x 40 2D tensor.  If an entry has size -1, this
   * corresponds to a dimension of unknown size. The names are
   * optional.
   * The order of entries in "dim" matters: It indicates the layout of the
   * values in the tensor in-memory representation.
   * The first entry in "dim" is the outermost dimension used to layout the
   * values, the last entry is the innermost dimension.  This matches the
   * in-memory layout of RowMajor Eigen tensors.
   * If "dim.size()" &gt; 0, "unknown_rank" must be false.
   * </pre>
   *
   * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
   */
  public int getDimCount() {
    return dim_.size();
  }
  /**
   * <pre>
   * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
   * for a 30 x 40 2D tensor.  If an entry has size -1, this
   * corresponds to a dimension of unknown size. The names are
   * optional.
   * The order of entries in "dim" matters: It indicates the layout of the
   * values in the tensor in-memory representation.
   * The first entry in "dim" is the outermost dimension used to layout the
   * values, the last entry is the innermost dimension.  This matches the
   * in-memory layout of RowMajor Eigen tensors.
   * If "dim.size()" &gt; 0, "unknown_rank" must be false.
   * </pre>
   *
   * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
   */
  public org.tensorflow.proto.framework.TensorShapeProto.Dim getDim(int index) {
    return dim_.get(index);
  }
  /**
   * <pre>
   * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
   * for a 30 x 40 2D tensor.  If an entry has size -1, this
   * corresponds to a dimension of unknown size. The names are
   * optional.
   * The order of entries in "dim" matters: It indicates the layout of the
   * values in the tensor in-memory representation.
   * The first entry in "dim" is the outermost dimension used to layout the
   * values, the last entry is the innermost dimension.  This matches the
   * in-memory layout of RowMajor Eigen tensors.
   * If "dim.size()" &gt; 0, "unknown_rank" must be false.
   * </pre>
   *
   * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
   */
  public org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder getDimOrBuilder(
      int index) {
    return dim_.get(index);
  }

  public static final int UNKNOWN_RANK_FIELD_NUMBER = 3;
  private boolean unknownRank_;
  /**
   * <pre>
   * If true, the number of dimensions in the shape is unknown.
   * If true, "dim.size()" must be 0.
   * </pre>
   *
   * <code>bool unknown_rank = 3;</code>
   */
  public boolean getUnknownRank() {
    return unknownRank_;
  }

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    for (int i = 0; i < dim_.size(); i++) {
      output.writeMessage(2, dim_.get(i));
    }
    if (unknownRank_ != false) {
      output.writeBool(3, unknownRank_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    for (int i = 0; i < dim_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, dim_.get(i));
    }
    if (unknownRank_ != false) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(3, unknownRank_);
    }
    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.TensorShapeProto)) {
      return super.equals(obj);
    }
    org.tensorflow.proto.framework.TensorShapeProto other = (org.tensorflow.proto.framework.TensorShapeProto) obj;

    if (!getDimList()
        .equals(other.getDimList())) return false;
    if (getUnknownRank()
        != other.getUnknownRank()) 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 (getDimCount() > 0) {
      hash = (37 * hash) + DIM_FIELD_NUMBER;
      hash = (53 * hash) + getDimList().hashCode();
    }
    hash = (37 * hash) + UNKNOWN_RANK_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
        getUnknownRank());
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.proto.framework.TensorShapeProto parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto 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.TensorShapeProto parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto 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.TensorShapeProto parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto 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.TensorShapeProto parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto 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.TensorShapeProto parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.proto.framework.TensorShapeProto 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.TensorShapeProto 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>
   * Dimensions of a tensor.
   * </pre>
   *
   * Protobuf type {@code tensorflow.TensorShapeProto}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.TensorShapeProto)
      org.tensorflow.proto.framework.TensorShapeProtoOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.proto.framework.TensorShapeProtos.internal_static_tensorflow_TensorShapeProto_descriptor;
    }

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

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

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getDimFieldBuilder();
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (dimBuilder_ == null) {
        dim_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
      } else {
        dimBuilder_.clear();
      }
      unknownRank_ = false;

      return this;
    }

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

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

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

    @java.lang.Override
    public org.tensorflow.proto.framework.TensorShapeProto buildPartial() {
      org.tensorflow.proto.framework.TensorShapeProto result = new org.tensorflow.proto.framework.TensorShapeProto(this);
      int from_bitField0_ = bitField0_;
      if (dimBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          dim_ = java.util.Collections.unmodifiableList(dim_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.dim_ = dim_;
      } else {
        result.dim_ = dimBuilder_.build();
      }
      result.unknownRank_ = unknownRank_;
      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.TensorShapeProto) {
        return mergeFrom((org.tensorflow.proto.framework.TensorShapeProto)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.proto.framework.TensorShapeProto other) {
      if (other == org.tensorflow.proto.framework.TensorShapeProto.getDefaultInstance()) return this;
      if (dimBuilder_ == null) {
        if (!other.dim_.isEmpty()) {
          if (dim_.isEmpty()) {
            dim_ = other.dim_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureDimIsMutable();
            dim_.addAll(other.dim_);
          }
          onChanged();
        }
      } else {
        if (!other.dim_.isEmpty()) {
          if (dimBuilder_.isEmpty()) {
            dimBuilder_.dispose();
            dimBuilder_ = null;
            dim_ = other.dim_;
            bitField0_ = (bitField0_ & ~0x00000001);
            dimBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getDimFieldBuilder() : null;
          } else {
            dimBuilder_.addAllMessages(other.dim_);
          }
        }
      }
      if (other.getUnknownRank() != false) {
        setUnknownRank(other.getUnknownRank());
      }
      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.TensorShapeProto parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.proto.framework.TensorShapeProto) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

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

    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.TensorShapeProto.Dim, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder, org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder> dimBuilder_;

    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.TensorShapeProto.Dim> getDimList() {
      if (dimBuilder_ == null) {
        return java.util.Collections.unmodifiableList(dim_);
      } else {
        return dimBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public int getDimCount() {
      if (dimBuilder_ == null) {
        return dim_.size();
      } else {
        return dimBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public org.tensorflow.proto.framework.TensorShapeProto.Dim getDim(int index) {
      if (dimBuilder_ == null) {
        return dim_.get(index);
      } else {
        return dimBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder setDim(
        int index, org.tensorflow.proto.framework.TensorShapeProto.Dim value) {
      if (dimBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureDimIsMutable();
        dim_.set(index, value);
        onChanged();
      } else {
        dimBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder setDim(
        int index, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder builderForValue) {
      if (dimBuilder_ == null) {
        ensureDimIsMutable();
        dim_.set(index, builderForValue.build());
        onChanged();
      } else {
        dimBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder addDim(org.tensorflow.proto.framework.TensorShapeProto.Dim value) {
      if (dimBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureDimIsMutable();
        dim_.add(value);
        onChanged();
      } else {
        dimBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder addDim(
        int index, org.tensorflow.proto.framework.TensorShapeProto.Dim value) {
      if (dimBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureDimIsMutable();
        dim_.add(index, value);
        onChanged();
      } else {
        dimBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder addDim(
        org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder builderForValue) {
      if (dimBuilder_ == null) {
        ensureDimIsMutable();
        dim_.add(builderForValue.build());
        onChanged();
      } else {
        dimBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder addDim(
        int index, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder builderForValue) {
      if (dimBuilder_ == null) {
        ensureDimIsMutable();
        dim_.add(index, builderForValue.build());
        onChanged();
      } else {
        dimBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder addAllDim(
        java.lang.Iterable<? extends org.tensorflow.proto.framework.TensorShapeProto.Dim> values) {
      if (dimBuilder_ == null) {
        ensureDimIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, dim_);
        onChanged();
      } else {
        dimBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder clearDim() {
      if (dimBuilder_ == null) {
        dim_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        dimBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public Builder removeDim(int index) {
      if (dimBuilder_ == null) {
        ensureDimIsMutable();
        dim_.remove(index);
        onChanged();
      } else {
        dimBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder getDimBuilder(
        int index) {
      return getDimFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder getDimOrBuilder(
        int index) {
      if (dimBuilder_ == null) {
        return dim_.get(index);  } else {
        return dimBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public java.util.List<? extends org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder> 
         getDimOrBuilderList() {
      if (dimBuilder_ != null) {
        return dimBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(dim_);
      }
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder addDimBuilder() {
      return getDimFieldBuilder().addBuilder(
          org.tensorflow.proto.framework.TensorShapeProto.Dim.getDefaultInstance());
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder addDimBuilder(
        int index) {
      return getDimFieldBuilder().addBuilder(
          index, org.tensorflow.proto.framework.TensorShapeProto.Dim.getDefaultInstance());
    }
    /**
     * <pre>
     * Dimensions of the tensor, such as {"input", 30}, {"output", 40}
     * for a 30 x 40 2D tensor.  If an entry has size -1, this
     * corresponds to a dimension of unknown size. The names are
     * optional.
     * The order of entries in "dim" matters: It indicates the layout of the
     * values in the tensor in-memory representation.
     * The first entry in "dim" is the outermost dimension used to layout the
     * values, the last entry is the innermost dimension.  This matches the
     * in-memory layout of RowMajor Eigen tensors.
     * If "dim.size()" &gt; 0, "unknown_rank" must be false.
     * </pre>
     *
     * <code>repeated .tensorflow.TensorShapeProto.Dim dim = 2;</code>
     */
    public java.util.List<org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder> 
         getDimBuilderList() {
      return getDimFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        org.tensorflow.proto.framework.TensorShapeProto.Dim, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder, org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder> 
        getDimFieldBuilder() {
      if (dimBuilder_ == null) {
        dimBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            org.tensorflow.proto.framework.TensorShapeProto.Dim, org.tensorflow.proto.framework.TensorShapeProto.Dim.Builder, org.tensorflow.proto.framework.TensorShapeProto.DimOrBuilder>(
                dim_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        dim_ = null;
      }
      return dimBuilder_;
    }

    private boolean unknownRank_ ;
    /**
     * <pre>
     * If true, the number of dimensions in the shape is unknown.
     * If true, "dim.size()" must be 0.
     * </pre>
     *
     * <code>bool unknown_rank = 3;</code>
     */
    public boolean getUnknownRank() {
      return unknownRank_;
    }
    /**
     * <pre>
     * If true, the number of dimensions in the shape is unknown.
     * If true, "dim.size()" must be 0.
     * </pre>
     *
     * <code>bool unknown_rank = 3;</code>
     */
    public Builder setUnknownRank(boolean value) {
      
      unknownRank_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * If true, the number of dimensions in the shape is unknown.
     * If true, "dim.size()" must be 0.
     * </pre>
     *
     * <code>bool unknown_rank = 3;</code>
     */
    public Builder clearUnknownRank() {
      
      unknownRank_ = false;
      onChanged();
      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.TensorShapeProto)
  }

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

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

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

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

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

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

}

