def test_connection_type_on_demand(self):
     """Connection type ON_DEMAND"""
     result = run_connection_type("ON_DEMAND")
     # Assert correct result.
     assert_result_equals_tensor_value(
         result['result'], np.array([3.0, 8.0], dtype=np.float32))
     # Assert single occurences of attach and compile
     # with compilation occuring first.
     assert (len(result['attach']) == 1), "Missing attach"
     assert (len(result['compile']) == 1), "Missing compile"
     assert (result['attach'][0] >
             result['compile'][0]), "Compile after attach"
 def test_connection_type_always(self):
     """Connection type ALWAYS"""
     result = run_connection_type("ALWAYS")
     # Assert correct result.
     assert_result_equals_tensor_value(
         result['result'], np.array([3.0, 8.0], dtype=np.float32))
     # Assert single occurences of attach and compile
     # with attach occuring first.
     assert (len(result['attach']) == 1), "Missing attach"
     assert (len(result['compile']) == 1), "Missing compile"
     assert (result['attach'][0] <
             result['compile'][0]), "Compile before attach"
Esempio n. 3
0
 def test_auto_sharding(self):
     """Automatic sharding example using 2 shards"""
     out = run_simple_sharding(True)
     assert_result_equals_tensor_value(
         out, np.array([3.0, 8.0], dtype=np.float32))
Esempio n. 4
0
 def test_manual_sharding(self):
     """Manual sharding example using 2 shards"""
     out = run_simple_sharding(False)
     assert_result_equals_tensor_value(
         out, np.array([3.0, 8.0], dtype=np.float32))