visdom_logger.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pytorch-visdom 作者: alexsax 项目源码 文件源码
def __init__(self, plot_type, fields, interval=None, win=None, env=None, opts={}):
        '''
            Args:
                plot_type: The name of the plot type, in Visdom
                fields: The fields to log. May either be the name of some stat (e.g. ProgressMonitor)
                    will have `stat_name='progress'`, in which case all of the fields under 
                    `log_HOOK_fields` will be logged. Finer-grained control can be specified
                    by using individual fields such as `progress.percent`. 
                interval: A List of 2-tuples where each tuple contains (k, HOOK_TIME). 
                    k (int): The logger will be called every 'k' HOOK_TIMES
                    HOOK_TIME (string): The logger will be called at the given hook

            Examples:
                >>> # Image example
                >>> img_to_use = skimage.data.coffee().swapaxes(0,2).swapaxes(1,2)
                >>> image_plug = ConstantMonitor(img_to_use, "image")
                >>> image_logger   = VisdomLogger('image', ["image.data"], [(2, 'iteration')])

                >>> # Histogram example
                >>> hist_plug = ConstantMonitor(np.random.rand(10000), "random")
                >>> hist_logger = VisdomLogger('histogram', ["random.data"], [(2, 'iteration')], opts=dict(title='Random!', numbins=20))
        '''
        super(VisdomLogger, self).__init__(fields, interval, win, env, opts)
        self.plot_type = plot_type
        self.chart = getattr(self.viz, plot_type)
        self.viz_logger = self._viz_prototype(self.chart)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号