【发布时间】:2021-06-24 11:09:12
【问题描述】:
我想将 github 项目 https://github.com/liupei101/TFDeepSurv von TF1 迁移到 TF2,因为其他依赖项。 使用 tf_upgrade_v2 脚本转换的问题文件是https://github.com/liupei101/TFDeepSurv/blob/master/tfdeepsurv/dsl.py。 此行无法转换
reg_item =tf.contrib.layers.l1_l2_regularize(self.config["L1_reg"], self.config["L2_reg"])
loss_reg = tf.contrib.layers.apply_regularization(reg_item, tf.compat.v1.get_collection("var_weight"))
对于第一个,我认为正确的迁移是:
reg_item = tf.keras.regularizers.L1L2(l1=self.config["L1_reg"], l2=self.config["L2_reg"])
哪一个是这两条线的正确替代品?
【问题讨论】:
标签: python tensorflow tf.keras