class_docstr: Implements proto splitter for GraphDef.
  
  This Splitter will modify the passed in proto in place.
class_docstr_tok: ["Implements","proto","splitter","for","GraphDef",".","This","Splitter","will","modify","the","passed","in","proto","in","place","."]
docstr: Splits a GraphDef proto into smaller chunks.
docstr_tok: ["Splits","a","GraphDef","proto","into","smaller","chunks","."]
code: def build_chunks(self):
      """Splits a GraphDef proto into smaller chunks."""
      proto = self._proto
      if not isinstance(proto, graph_pb2.GraphDef):
          raise TypeError("Can only split GraphDef type protos.")
  
      proto_size = proto.ByteSize()
      if proto_size < constants.max_size():
          return
  
      # Split `GraphDef.node`
      node_splitter = RepeatedMessageSplitter(
          proto,
          "node",
          [ConstantNodeDefSplitter, LargeMessageSplitter],
          parent_splitter=self,
          fields_in_parent=[],
      )
  
      # Split `GraphDef.library.function`
      function_splitter = RepeatedMessageSplitter(
          proto.library,
          ["function"],
          [FunctionDefSplitter],
          parent_splitter=self,
          fields_in_parent=["library"],
      )
  
      library_size = proto.library.ByteSize()
      approx_node_size = proto_size - library_size
  
      if library_size > approx_node_size:
          library_size -= function_splitter.build_chunks()
          if library_size + approx_node_size > constants.max_size():
              approx_node_size -= node_splitter.build_chunks()
  
      else:
          approx_node_size -= node_splitter.build_chunks()
          if library_size + approx_node_size > constants.max_size():
              library_size -= function_splitter.build_chunks()
  
      if proto.ByteSize() > constants.max_size():
          # Since there are chunks with the "library" field tag, insert this
          # chunk before the other chunks at index 1 (index 0 is reserved for the
          # base chunk).
          self.add_chunk(proto.library, ["library"], 1)
          proto.ClearField("library")
  
imports: from collections.abc import Sequence
  import itertools
  from typing import Optional, Type
  from google.protobuf import message
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.framework import tensor_util
  from tensorflow.tools.proto_splitter import constants
  from tensorflow.tools.proto_splitter import split
  from tensorflow.tools.proto_splitter import util
label_desc: Use image node_id 1 for calling the GraphDefSplitter obj's underlying member method code with example usage: obj.build_chunks() without return types