Python sonnet.get_variables_in_scope() Examples

The following are 1 code examples of sonnet.get_variables_in_scope(). 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 sonnet , or try the search function .
Example #1
Source File: model_test.py    From leo with Apache License 2.0 6 votes vote down vote up
def test_variable_creation(self):
    self._leo(self._problem)
    encoder_variables = snt.get_variables_in_scope("leo/encoder")
    self.assertNotEmpty(encoder_variables)
    relation_network_variables = snt.get_variables_in_scope(
        "leo/relation_network")
    self.assertNotEmpty(relation_network_variables)
    decoder_variables = snt.get_variables_in_scope("leo/decoder")
    self.assertNotEmpty(decoder_variables)
    inner_lr = snt.get_variables_in_scope("leo/leo_inner")
    self.assertNotEmpty(inner_lr)
    finetuning_lr = snt.get_variables_in_scope("leo/finetuning")
    self.assertNotEmpty(finetuning_lr)
    self.assertSameElements(
        encoder_variables + relation_network_variables + decoder_variables +
        inner_lr + finetuning_lr, self._leo.trainable_variables)