def toc(self):
        """End collecting for current batch and return results.
        Call after computation of current batch.

        Returns
        -------
        res : list of """
        if not self.activated:
            return []
        for exe in self.exes:
            for array in exe.arg_arrays:
                array.wait_to_read()
            for array in exe.aux_arrays:
                array.wait_to_read()
        for exe in self.exes:
            for name, array in zip(exe._symbol.list_arguments(), exe.arg_arrays):
                if self.re_prog.match(name):
                    self.queue.append((self.step, name, self.stat_func(array)))
            for name, array in zip(exe._symbol.list_auxiliary_states(), exe.aux_arrays):
                if self.re_prog.match(name):
                    self.queue.append((self.step, name, self.stat_func(array)))
        self.activated = False
        res = []
        if self.sort:
            self.queue.sort(key=lambda x: x[1])
        for n, k, v_list in self.queue:
            if isinstance(v_list, NDArray):
                v_list = [v_list]
            assert isinstance(v_list, list)
            s = ''
            for v in v_list:
                assert isinstance(v, NDArray)
                if v.shape == (1,):
                    s += str(v.asscalar()) + '\t'
                else:
                    s += str(v.asnumpy()) + '\t'
            res.append((n, k, s))
        self.queue = []
        return res
def toc ( self ) : if not self . activated : return [ ] for exe in self . exes : for array in exe . arg_arrays : array . wait_to_read ( ) for array in exe . aux_arrays : array . wait_to_read ( ) for exe in self . exes : for name , array in zip ( exe . _symbol . list_arguments ( ) , exe . arg_arrays ) : if self . re_prog . match ( name ) : self . queue . append ( ( self . step , name , self . stat_func ( array ) ) ) for name , array in zip ( exe . _symbol . list_auxiliary_states ( ) , exe . aux_arrays ) : if self . re_prog . match ( name ) : self . queue . append ( ( self . step , name , self . stat_func ( array ) ) ) self . activated = False res = [ ] if self . sort : self . queue . sort ( key = lambda x : x [ 1 ] ) for n , k , v_list in self . queue : if isinstance ( v_list , NDArray ) : v_list = [ v_list ] assert isinstance ( v_list , list ) s = '' for v in v_list : assert isinstance ( v , NDArray ) if v . shape == ( 1 , ) : s += str ( v . asscalar ( ) ) + '\t' else : s += str ( v . asnumpy ( ) ) + '\t' res . append ( ( n , k , s ) ) self . queue = [ ] return res
End collecting for current batch and return results.
        Call after computation of current batch.

        Returns
        -------
        res : list of