tensorflow报错AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'contrib'

问题遇到的现象和发生背景

安装tensorflow2.9.1后没有tf.contrib.layers.batch_norm函数

问题相关代码,请勿粘贴截图
        output = tf.contrib.layers.batch_norm(
            input,
            activation_fn=activation_fn,
            training=is_training,
            updates_collections=None,
            scale=scale,
            scope=scope)
运行结果及报错内容

AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'contrib'

我的解答思路和尝试过的方法

尝试将import tensorflow as tf 改为 import tensorflow._api.v2.compat.v1 as tf
同时将tf.contrib.layers.batch_norm 改为tf.layers.batch_normalization 但是不知道怎么改参数

你把全部报错复制到记事本发给我