import numpy as np
import caffe2.proto.caffe2_pb2 as caffe2_pb2
-from caffe2.python import core, workspace, timeout_guard
+from caffe2.python import core, workspace, timeout_guard, test_util
-class BlobsQueueDBTest(unittest.TestCase):
+class BlobsQueueDBTest(test_util.TestCase):
def test_create_blobs_queue_db_string(self):
def add_blobs(queue, num_samples):
blob = core.BlobReference("blob")
from __future__ import print_function
from __future__ import unicode_literals
-from caffe2.python import core, workspace
+from caffe2.python import core, workspace, test_util
import os
import shutil
import tempfile
import unittest
-class CheckpointTest(unittest.TestCase):
+class CheckpointTest(test_util.TestCase):
"""A simple test case to make sure that the checkpoint behavior is correct.
"""
net.Iter([], "iter")
net.ConstantFill([], "value", shape=[1, 2, 3])
net.Checkpoint(["iter", "value"], [],
- db=os.path.join(temp_root, "test_checkpoint_at_%05d"),
- db_type="leveldb", every=10, absolute_path=True)
+ db=os.path.join(temp_root, "test_checkpoint_at_%05d"),
+ db_type="leveldb", every=10, absolute_path=True)
self.assertTrue(workspace.CreateNet(net))
for i in range(100):
self.assertTrue(workspace.RunNet("test_checkpoint"))
if __name__ == "__main__":
- import unittest
unittest.main()
import unittest
from caffe2.proto import caffe2_pb2
-from caffe2.python import workspace, core, model_helper, brew
+from caffe2.python import workspace, core, model_helper, brew, test_util
-class CopyOpsTest(unittest.TestCase):
+class CopyOpsTest(test_util.TestCase):
def tearDown(self):
# Reset workspace after each test
class TestHeatmapMaxKeypointOp(hu.HypothesisTestCase):
def setUp(self):
+ super(TestHeatmapMaxKeypointOp, self).setUp()
np.random.seed(0)
# initial coordinates and interpolate HEATMAP_SIZE from it
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
-from caffe2.python import model_helper, workspace, core, rnn_cell
+from caffe2.python import model_helper, workspace, core, rnn_cell, test_util
from caffe2.python.attention import AttentionType
import numpy as np
from hypothesis import given
-class TestRNNExecutor(unittest.TestCase):
+class TestRNNExecutor(test_util.TestCase):
def setUp(self):
+ super(TestRNNExecutor, self).setUp()
self.batch_size = 8
self.input_dim = 20
self.hidden_dim = 30
self.assertEqual(1 if forward_only else 2, num_found)
if __name__ == "__main__":
- import unittest
import random
random.seed(2603)
workspace.GlobalInit([