Esempio n. 1
0
    def __init__(self,
                 metagraph,
                 ignore_colocation=True,
                 ignore_user_placement=False):
        """Creates an Item.

    Args:
      metagraph: a TensorFlow metagraph.
      ignore_colocation: if set, the tool will ignore all the colocation
        constraints generated by TensorFlow.
      ignore_user_placement: if set, all the placement annotations annotated in
        the metagraph will be ignored.
    Raises:
      ValueError: the metagraph is incomplete or invalid.
    """
        self._metagraph = metagraph
        self._tf_item = None
        with errors.raise_exception_on_not_ok_status() as status:
            self._tf_item = tf_item.TF_NewItem(metagraph.SerializeToString(),
                                               ignore_colocation,
                                               ignore_user_placement, status)
Esempio n. 2
0
 def _BuildTFItem(self):
     with errors.raise_exception_on_not_ok_status() as status:
         self._tf_item = tf_item.TF_NewItem(
             self._metagraph.SerializeToString(), self._ignore_colocation,
             self._ignore_user_placement, status)
Esempio n. 3
0
 def _BuildTFItem(self):
     self._tf_item = tf_item.TF_NewItem(self._metagraph.SerializeToString(),
                                        self._ignore_colocation,
                                        self._ignore_user_placement)