2016-05-13 21:43:48 +00:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
from __future__ import division
|
|
|
|
|
from __future__ import print_function
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
import numpy as np
|
|
|
|
|
from caffe2.python import workspace
|
|
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def rand_array(*dims):
|
|
|
|
|
# np.random.rand() returns float instead of 0-dim array, that's why need to
|
|
|
|
|
# do some tricks
|
|
|
|
|
return np.array(np.random.rand(*dims) - 0.5).astype(np.float32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestCase(unittest.TestCase):
|
2016-07-21 17:16:42 +00:00
|
|
|
@classmethod
|
|
|
|
|
def setUpClass(cls):
|
|
|
|
|
workspace.GlobalInit([
|
|
|
|
|
'caffe2',
|
|
|
|
|
'--caffe2_log_level=0',
|
|
|
|
|
])
|
|
|
|
|
|
2016-05-13 21:43:48 +00:00
|
|
|
def setUp(self):
|
2016-09-06 22:54:56 +00:00
|
|
|
self.ws = workspace.C.Workspace()
|
2016-05-13 21:43:48 +00:00
|
|
|
workspace.ResetWorkspace()
|
|
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
|
workspace.ResetWorkspace()
|