Пример #1
0
 def setUp(self):
     cuda.memory_pool.free_all_blocks()
     self.h = function_hooks.CupyMemoryProfileHook()
     self.f1 = functions.math.exponential.Exp()
     self.f2 = functions.activation.relu.ReLU()
     self.x = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
     x = cuda.to_gpu(self.x)
     with self.h:
         self.f1.apply((chainer.Variable(x),))
         self.f1.apply((chainer.Variable(x),))
         self.f2.apply((chainer.Variable(x),))
         self.f2.apply((chainer.Variable(x),))
Пример #2
0
 def setUp(self):
     cuda.memory_pool.free_all_blocks()
     self.h = function_hooks.CupyMemoryProfileHook()
     f1 = functions.exp
     f2 = functions.relu
     self.x = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
     x = cuda.to_gpu(self.x)
     with self.h:
         f1(chainer.Variable(x))
         f1(chainer.Variable(x))
         f2(chainer.Variable(x))
         f2(chainer.Variable(x))
Пример #3
0
 def setUp(self):
     self.h = function_hooks.CupyMemoryProfileHook()
     self.f = functions.math.exponential.Exp()
     self.f.add_hook(self.h)
     self.x = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
     self.gy = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
Пример #4
0
 def setUp(self):
     self.h = function_hooks.CupyMemoryProfileHook()
     self.l = SimpleLink()
     self.x = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
     self.gy = numpy.random.uniform(-0.1, 0.1, (3, 5)).astype(numpy.float32)
Пример #5
0
 def test_choose_unit(self):
     h = function_hooks.CupyMemoryProfileHook()
     self.assertEqual((self.denomi, self.unit), h._choose_unit(self.bytes))