class_docstr: Helper class to conveniently convert between partition list and partition string.
class_docstr_tok: ["Helper","class","to","conveniently","convert","between","partition","list","and","partition","string","."]
code: def __init__(self, partition_list=None, partition_str=None):
      if partition_list:
          self._partition_list = partition_list
          self._partition_str = self.serialize(partition_list)
      elif partition_str:
          self._partition_list = self.deserialize(partition_str)
          self._partition_str = partition_str
      else:
          raise ValueError(
              "At least and only one of partition_list and partition_str needs to be provided."
          )
  
imports: import collections
  import re
  from google.protobuf.pyext._message import RepeatedScalarContainer
  from tensorflow.core.framework import graph_pb2
  from tensorflow.python import ops
  from tensorflow.python.framework import dtypes, versions
  from tensorflow.python.ops import embedding_ops
  from tensorflow.python.ops import variable_scope, array_ops, math_ops
  from tensorflow.python.ops.variables import Variable, PartitionedVariable
  from tensorflow.python.util.compat import as_bytes
  from autodist.const import AUTODIST_TO_DELETE_SCOPE, COLOCATION_PREFIX
  from autodist.checkpoint.saver import Saver
  from autodist.graph_item import GraphItem, Info
  from autodist.kernel.common.op_info import MUTABLE_STATE_OP_DIRECT_CONSUMER_OPS
  from autodist.kernel.common.utils import get_op_name, get_consumers, update_consumers, parse_name_scope
  from autodist.kernel.common.variable_utils import is_read_var_op
  from autodist.kernel.kernel import Kernel
  from autodist.utils import logging
label_desc: Use image node_id 1 to create a new PartitionerConfig object  with example: obj = PartitionerConfig(partition_list, partition_str)