)
    def test_distributed_discrete_gaussian_tree_aggregation_no_overflow(
            self, value_shape, num_clients, arity):
        client_records = []
        for _ in range(num_clients):
            client_records.append(np.zeros(value_shape, dtype=int).tolist())

        agg_factory = hihi_factory.create_hierarchical_histogram_aggregation_factory(
            num_bins=value_shape,
            arity=arity,
            clip_mechanism='sub-sampling',
            max_records_per_user=1,
            dp_mechanism='distributed-discrete-gaussian',
            noise_multiplier=0,
            enable_secure_sum=True)
        value_type = computation_types.to_type((tf.int32, (value_shape, )))
        process = agg_factory.create(value_type)

        state = process.initialize()
        output = process.next(state, client_records).result

        reference_aggregated_record = build_tree_from_leaf.create_hierarchical_histogram(
            np.zeros_like(client_records[0], dtype=int).tolist(), arity)

        self.assertAllClose(output, reference_aggregated_record)


if __name__ == '__main__':
    execution_contexts.set_test_python_execution_context()
    tf.test.main()
 def setUp(self):
     super().setUp()
     execution_contexts.set_test_python_execution_context()