text: // GENERATED FILE - DO NOT MODIFY
  #include "tensorflow/core/framework/tensor_shape.pb_text-impl.h"
  
  using ::tensorflow::strings::Scanner;
  using ::tensorflow::strings::StrCat;
  
  namespace tensorflow {
  
  string ProtoDebugString(
      const ::tensorflow::TensorShapeProto_Dim& msg) {
    string s;
    ::tensorflow::strings::ProtoTextOutput o(&s, false);
    internal::AppendProtoDebugString(&o, msg);
    o.CloseTopMessage();
    return s;
  }
  
  string ProtoShortDebugString(
      const ::tensorflow::TensorShapeProto_Dim& msg) {
    string s;
    ::tensorflow::strings::ProtoTextOutput o(&s, true);
    internal::AppendProtoDebugString(&o, msg);
    o.CloseTopMessage();
    return s;
  }
  
  namespace internal {
  
  void AppendProtoDebugString(
      ::tensorflow::strings::ProtoTextOutput* o,
      const ::tensorflow::TensorShapeProto_Dim& msg) {
    o->AppendNumericIfNotZero("size", msg.size());
    o->AppendStringIfNotEmpty("name", ProtobufStringToString(msg.name()));
  }
  
  }  // namespace internal
  
  bool ProtoParseFromString(
      const string& s,
      ::tensorflow::TensorShapeProto_Dim* msg) {
    msg->Clear();
    Scanner scanner(s);
    if (!internal::ProtoParseFromScanner(&scanner, false, false, msg)) return false;
    scanner.Eos();
    return scanner.GetResult();
  }
  
  namespace internal {
  
  bool ProtoParseFromScanner(
      ::tensorflow::strings::Scanner* scanner, bool nested, bool close_curly,
      ::tensorflow::TensorShapeProto_Dim* msg) {
    std::vector<bool> has_seen(2, false);
    while(true) {
      ProtoSpaceAndComments(scanner);
      if (nested && (scanner->Peek() == (close_curly ? '}' : '>'))) {
        scanner->One(Scanner::ALL);
        ProtoSpaceAndComments(scanner);
        return true;
      }
      if (!nested && scanner->empty()) { return true; }
      scanner->RestartCapture()
          .Many(Scanner::LETTER_DIGIT_UNDERSCORE)
          .StopCapture();
      StringPiece identifier;
      if (!scanner->GetResult(nullptr, &identifier)) return false;
      bool parsed_colon = false;
      (void)parsed_colon;
      ProtoSpaceAndComments(scanner);
      if (scanner->Peek() == ':') {
        parsed_colon = true;
        scanner->One(Scanner::ALL);
        ProtoSpaceAndComments(scanner);
      }
      if (identifier == "size") {
        if (has_seen[0]) return false;
        has_seen[0] = true;
        int64 value;
        if (!parsed_colon || !::tensorflow::strings::ProtoParseNumericFromScanner(scanner, &value)) return false;
        msg->set_size(value);
      }
      else if (identifier == "name") {
        if (has_seen[1]) return false;
        has_seen[1] = true;
        string str_value;
        if (!parsed_colon || !::tensorflow::strings::ProtoParseStringLiteralFromScanner(
            scanner, &str_value)) return false;
        SetProtobufStringSwapAllowed(&str_value, msg->mutable_name());
      }
    }
  }
  
  }  // namespace internal
  
  string ProtoDebugString(
      const ::tensorflow::TensorShapeProto& msg) {
    string s;
    ::tensorflow::strings::ProtoTextOutput o(&s, false);
    internal::AppendProtoDebugString(&o, msg);
    o.CloseTopMessage();
    return s;
  }
  
  string ProtoShortDebugString(
      const ::tensorflow::TensorShapeProto& msg) {
    string s;
    ::tensorflow::strings::ProtoTextOutput o(&s, true);
    internal::AppendProtoDebugString(&o, msg);
    o.CloseTopMessage();
    return s;
  }
  
  namespace internal {
  
  void AppendProtoDebugString(
      ::tensorflow::strings::ProtoTextOutput* o,
      const ::tensorflow::TensorShapeProto& msg) {
    for (int i = 0; i < msg.dim_size(); ++i) {
      o->OpenNestedMessage("dim");
      ::tensorflow::internal::AppendProtoDebugString(o, msg.dim(i));
      o->CloseNestedMessage();
    }
    o->AppendBoolIfTrue("unknown_rank", msg.unknown_rank());
  }
  
  }  // namespace internal
  
  bool ProtoParseFromString(
      const string& s,
      ::tensorflow::TensorShapeProto* msg) {
    msg->Clear();
    Scanner scanner(s);
    if (!internal::ProtoParseFromScanner(&scanner, false, false, msg)) return false;
    scanner.Eos();
    return scanner.GetResult();
  }
  
  namespace internal {
  
  bool ProtoParseFromScanner(
      ::tensorflow::strings::Scanner* scanner, bool nested, bool close_curly,
      ::tensorflow::TensorShapeProto* msg) {
    std::vector<bool> has_seen(2, false);
    while(true) {
      ProtoSpaceAndComments(scanner);
      if (nested && (scanner->Peek() == (close_curly ? '}' : '>'))) {
        scanner->One(Scanner::ALL);
        ProtoSpaceAndComments(scanner);
        return true;
      }
      if (!nested && scanner->empty()) { return true; }
      scanner->RestartCapture()
          .Many(Scanner::LETTER_DIGIT_UNDERSCORE)
          .StopCapture();
      StringPiece identifier;
      if (!scanner->GetResult(nullptr, &identifier)) return false;
      bool parsed_colon = false;
      (void)parsed_colon;
      ProtoSpaceAndComments(scanner);
      if (scanner->Peek() == ':') {
        parsed_colon = true;
        scanner->One(Scanner::ALL);
        ProtoSpaceAndComments(scanner);
      }
      if (identifier == "dim") {
        const bool is_list = (scanner->Peek() == '[');
        do {
          if (is_list) {
            scanner->One(Scanner::ALL);
            ProtoSpaceAndComments(scanner);
          }
          const char open_char = scanner->Peek();
          if (open_char != '{' && open_char != '<') return false;
          scanner->One(Scanner::ALL);
          ProtoSpaceAndComments(scanner);
          if (!::tensorflow::internal::ProtoParseFromScanner(
              scanner, true, open_char == '{', msg->add_dim())) return false;
        } while (is_list && scanner->Peek() == ',');
        if (is_list && !scanner->OneLiteral("]").GetResult()) return false;
      }
      else if (identifier == "unknown_rank") {
        if (has_seen[1]) return false;
        has_seen[1] = true;
        bool value;
        if (!parsed_colon || !::tensorflow::strings::ProtoParseBoolFromScanner(scanner, &value)) return false;
        msg->set_unknown_rank(value);
      }
    }
  }
  
  }  // namespace internal
  
  }  // namespace tensorflow
  