當前位置: 首頁>>代碼示例>>Python>>正文


Python base.DataFlowTerminated方法代碼示例

本文整理匯總了Python中tensorpack.dataflow.base.DataFlowTerminated方法的典型用法代碼示例。如果您正苦於以下問題:Python base.DataFlowTerminated方法的具體用法?Python base.DataFlowTerminated怎麽用?Python base.DataFlowTerminated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tensorpack.dataflow.base的用法示例。


在下文中一共展示了base.DataFlowTerminated方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from tensorpack.dataflow import base [as 別名]
# 或者: from tensorpack.dataflow.base import DataFlowTerminated [as 別名]
def run(self):
        with self.default_sess():
            try:
                while not self._coord.should_stop():
                    try:
                        self.ds.reset_state()
                        while True:
                            for dp in self.ds.get_data():
                                feed = dict(zip(self.placeholders, dp))
                                self.op.run(feed_dict=feed)
                    except (tf.errors.CancelledError, tf.errors.OutOfRangeError, DataFlowTerminated):
                        pass
                    except Exception as e:
                        if isinstance(e, RuntimeError) and 'closed Session' in str(e):
                            pass
                        else:
                            logging.exception("Exception in {}:{}".format(self.name, str(e)))
            except Exception as e:
                logging.exception("Exception in {}:{}".format(self.name, str(e)))
            finally:
                try:
                    self.close_op.run()
                except Exception:
                    pass
                logging.info("{} Exited.".format(self.name)) 
開發者ID:ildoonet,項目名稱:tf-lcnn,代碼行數:27,代碼來源:data_feeder.py

示例2: run

# 需要導入模塊: from tensorpack.dataflow import base [as 別名]
# 或者: from tensorpack.dataflow.base import DataFlowTerminated [as 別名]
def run(self):
        with self.default_sess():
            try:
                while not self._coord.should_stop():
                    try:
                        self.ds.reset_state()
                        while True:
                            for dp in self.ds.get_data():
                                feed = dict(zip(self.placeholders, dp))
                                self.op.run(feed_dict=feed)
                                self.last_dp = dp
                    except (tf.errors.CancelledError, tf.errors.OutOfRangeError, DataFlowTerminated):
                        logger.error('err type1, placeholders={}'.format(self.placeholders))
                        sys.exit(-1)
                    except Exception as e:
                        logger.error('err type2, err={}, placeholders={}'.format(str(e), self.placeholders))
                        if isinstance(e, RuntimeError) and 'closed Session' in str(e):
                            pass
                        else:
                            logger.exception("Exception in {}:{}".format(self.name, str(e)))
                        sys.exit(-1)
            except Exception as e:
                logger.exception("Exception in {}:{}".format(self.name, str(e)))
            finally:
                try:
                    self.close_op.run()
                except Exception:
                    pass
                logger.info("{} Exited.".format(self.name)) 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:31,代碼來源:pose_dataset.py


注:本文中的tensorpack.dataflow.base.DataFlowTerminated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。