Python blocks.extensions.SimpleExtension() Examples

The following are 2 code examples of blocks.extensions.SimpleExtension(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module blocks.extensions , or try the search function .
Example #1
Source File: test_plot.py    From attention-lvcsr with MIT License 5 votes vote down vote up
def test_plot():
    class Writer(SimpleExtension):
        def do(self, *args, **kwargs):
            self.main_loop.log.current_row['channel'] = (
                self.main_loop.status['iterations_done'] ** 2)
    main_loop = MockMainLoop(extensions=[
        Writer(after_batch=True),
        Plot('test', [['channel']]).set_conditions(after_batch=True),
        FinishAfter(after_n_batches=11)])
    main_loop.run() 
Example #2
Source File: test_plot.py    From blocks-extras with MIT License 5 votes vote down vote up
def test_plot():
    class Writer(SimpleExtension):
        def do(self, *args, **kwargs):
            self.main_loop.log.current_row['channel'] = (
                self.main_loop.status['iterations_done'] ** 2)
    main_loop = MockMainLoop(extensions=[
        Writer(after_batch=True),
        Plot('test', [['channel']]).set_conditions(after_batch=True),
        FinishAfter(after_n_batches=11)])
    main_loop.run()