def test_get_cardinalities_failure(self): with self.assertRaises(ValueError): reference_executor.get_cardinalities( reference_executor.ComputedValue( anonymous_tuple.AnonymousTuple([('A', [1, 2, 3]), ('B', [1, 2])]), [('A', computation_types.FederatedType(tf.int32, placements.CLIENTS)), ('B', computation_types.FederatedType(tf.int32, placements.CLIENTS)) ]))
def test_get_cardinalities_success(self): foo = reference_executor.get_cardinalities( reference_executor.ComputedValue( anonymous_tuple.AnonymousTuple( [('A', [1, 2, 3]), ('B', anonymous_tuple.AnonymousTuple( [('C', [[1, 2], [3, 4], [5, 6]]), ('D', [True, False, True])]))]), [('A', computation_types.FederatedType(tf.int32, placements.CLIENTS)), ('B', [('C', computation_types.FederatedType( computation_types.SequenceType(tf.int32), placements.CLIENTS)), ('D', computation_types.FederatedType(tf.bool, placements.CLIENTS))])])) self.assertDictEqual(foo, {placements.CLIENTS: 3})