Exemplo n.º 1
0
 def test1_abstract_layer(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "input",
             verbose = self.verbose)
     self.attributes = self.layer._graph_attributes()
     self.assertEqual(self.attributes['id'], self.abstract_layer_name)
Exemplo n.º 2
0
 def test16_abstract_layer_get_params(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "conv",
             verbose = self.verbose)
     self.layer.params = [self.input_tensor,self.input_tensor]
     out = self.layer.get_params(borrow=True,verbose=self.verbose)
     self.assertTrue(numpy.allclose(out,[self.input_ndarray,self.input_ndarray]))
Exemplo n.º 3
0
 def test2_abstract_layer_exception(self):
     try:
         self.layer = l(
             id = self.abstract_layer_name,
             type= "input",
             verbose = self.verbose)
         self.params = self.layer.get_params()
     except Exception,c:
         self.assertEqual(c.message,self.exception_msg)
Exemplo n.º 4
0
 def test17_abstract_layer_get_params(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "conv",
             verbose = self.verbose)
     self.val = T.dot(self.input_tensor,self.input_tensor)
     self.layer.params = [self.val]
     out = self.layer.get_params(borrow=True,verbose=self.verbose)
     self.assertTrue(numpy.allclose(out,self.val.eval()))
Exemplo n.º 5
0
 def test19_abstract_layer_graph_attributes(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "input",
             verbose = self.verbose)
     self.layer.output_shape = self.input_shape
     self.layer.num_neurons = 10
     self.layer.activation = ('Relu', 'maxout')
     self.attributes = self.layer._graph_attributes()
     self.assertEqual(self.attributes['id'], self.abstract_layer_name)
     self.assertEqual(self.attributes['num_neurons'], 10)
Exemplo n.º 6
0
 def test18_abstract_layer_get_params(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "conv",
             verbose = self.verbose)
     self.val = T.dot(self.input_tensor,self.input_tensor)
     self.layer.params = [self.val]
     self.layer.output_shape = self.input_shape
     self.layer.num_neurons = 10
     self.layer.activation = ('ReLu')
     out = self.layer.get_params(borrow=True,verbose=self.verbose)
     self.assertTrue(numpy.allclose(out,self.val.eval()))
Exemplo n.º 7
0
 def test15_abstract_layer_print_layer(self):
     self.layer = l(
             id = self.abstract_layer_name,
             type= "convolution",
             verbose = self.verbose)
     self.attributes = self.layer._graph_attributes()
     self.layer.output_shape = self.input_shape
     self.layer.origin =  "input"
     self.layer.destination = "classifier"
     self.layer.batch_norm = False
     self.layer.print_layer(prefix = " ", nest = False, last = False, verbose = self.verbose)
     self.assertTrue(len(self.layer.prefix)>0)