コード例 #1
0
  def test_reconcile_value_type_with_type_spec_raises_type_error_value_type_and_bad_type_spec(
      self):
    value_type = computation_types.TensorType(tf.int32)
    type_spec = computation_types.TensorType(tf.string)

    with self.assertRaises(TypeError):
      executor_utils.reconcile_value_type_with_type_spec(value_type, type_spec)
コード例 #2
0
def _serialize_computation(
        comp: computation_pb2.Computation,
        type_spec: Optional[computation_types.Type]) -> _SerializeReturnType:
    """Serializes a TFF computation."""
    type_spec = executor_utils.reconcile_value_type_with_type_spec(
        type_serialization.deserialize_type(comp.type), type_spec)
    return executor_pb2.Value(computation=comp), type_spec
コード例 #3
0
 def test_reconcile_value_type_with_type_spec_returns_type(
     self, value_type, type_spec, expected_type):
   actual_type = executor_utils.reconcile_value_type_with_type_spec(
       value_type, type_spec)
   self.assertEqual(actual_type, expected_type)