def test_executor_call_unsupported_intrinsic(self): dummy_intrinsic = intrinsic_defs.IntrinsicDef( 'DUMMY_INTRINSIC', 'dummy_intrinsic', computation_types.AbstractType('T')) comp = pb.Computation(intrinsic=pb.Intrinsic(uri='dummy_intrinsic'), type=type_serialization.serialize_type(tf.int32)) with self.assertRaises(NotImplementedError): _run_test_comp(comp, num_clients=3)
def test_raises_not_implemented_error_with_unimplemented_intrinsic(self): executor = create_test_executor() dummy_intrinsic = intrinsic_defs.IntrinsicDef( 'DUMMY_INTRINSIC', 'dummy_intrinsic', computation_types.AbstractType('T')) comp = pb.Computation(intrinsic=pb.Intrinsic(uri='dummy_intrinsic'), type=type_serialization.serialize_type(tf.int32)) comp = self.run_sync(executor.create_value(comp)) with self.assertRaises(NotImplementedError): self.run_sync(executor.create_call(comp))
def test_raises_not_implemented_error_with_unimplemented_intrinsic(self): executor = create_test_executor() # `whimsy_intrinsic` definition is needed to allow lookup. whimsy_intrinsic = intrinsic_defs.IntrinsicDef( 'WHIMSY_INTRINSIC', 'whimsy_intrinsic', computation_types.AbstractType('T')) type_signature = computation_types.TensorType(tf.int32) comp = pb.Computation( intrinsic=pb.Intrinsic(uri='whimsy_intrinsic'), type=type_serialization.serialize_type(type_signature)) del whimsy_intrinsic comp = self.run_sync(executor.create_value(comp)) with self.assertRaises(NotImplementedError): self.run_sync(executor.create_call(comp))
def test_executor_call_unsupported_intrinsic(self): dummy_intrinsic = intrinsic_defs.IntrinsicDef( 'DUMMY_INTRINSIC', 'dummy_intrinsic', computation_types.AbstractType('T')) comp = pb.Computation(type=type_serialization.serialize_type(tf.int32), intrinsic=pb.Intrinsic(uri='dummy_intrinsic')) loop = asyncio.get_event_loop() executor = composing_executor.ComposingExecutor( _create_bottom_stack(), [_create_worker_stack() for _ in range(3)]) with self.assertRaises(NotImplementedError): v1 = loop.run_until_complete(executor.create_value(comp, tf.int32)) loop.run_until_complete(executor.create_call(v1, None))
def test_executor_call_unsupported_intrinsic(self): dummy_intrinsic = intrinsic_defs.IntrinsicDef( 'DUMMY_INTRINSIC', 'dummy_intrinsic', computation_types.AbstractType('T')) type_signature = computation_types.TensorType(tf.int32) comp = pb.Computation( type=type_serialization.serialize_type(type_signature), intrinsic=pb.Intrinsic(uri='dummy_intrinsic')) loop = asyncio.get_event_loop() factory = federated_composing_strategy.FederatedComposingStrategy.factory( _create_bottom_stack(), [_create_worker_stack()]) executor = federating_executor.FederatingExecutor( factory, _create_bottom_stack()) v1 = loop.run_until_complete(executor.create_value(comp)) with self.assertRaises(NotImplementedError): loop.run_until_complete(executor.create_call(v1))
def test_executor_call_unsupported_intrinsic(self): # `whimsy_intrinsic` definition is needed to allow successful lookup. whimsy_intrinsic = intrinsic_defs.IntrinsicDef( 'WHIMSY_INTRINSIC', 'whimsy_intrinsic', computation_types.AbstractType('T')) type_signature = computation_types.TensorType(tf.int32) comp = pb.Computation( type=type_serialization.serialize_type(type_signature), intrinsic=pb.Intrinsic(uri='whimsy_intrinsic')) del whimsy_intrinsic factory = federated_composing_strategy.FederatedComposingStrategy.factory( _create_bottom_stack(), [_create_worker_stack()]) executor = federating_executor.FederatingExecutor( factory, _create_bottom_stack()) v1 = asyncio.run(executor.create_value(comp)) with self.assertRaises(NotImplementedError): asyncio.run(executor.create_call(v1))