vae_cf icon indicating copy to clipboard operation
vae_cf copied to clipboard

Getting Error When importing "import apply_regularization, l2_regularizer"

Open anandece4u opened this issue 3 years ago • 2 comments

Hi I am getting error while running the notebook in line where we are importing

from tensorflow.contrib.layers import apply_regularization, l2_regularizer

`--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in 15 16 import tensorflow as tf ---> 17 from tensorflow.contrib.layers import apply_regularization, l2_regularizer 18 19 import bottleneck as bn

ModuleNotFoundError: No module named 'tensorflow.contrib'`

Please help

anandece4u avatar Mar 24 '21 09:03 anandece4u

You can try with tensorflow-gpu==1.15

TruongThuyLiem avatar Jun 01 '21 03:06 TruongThuyLiem

You could also try to to just apply L2 regularization directly than a two-step process as in tf 1.15, I did this to make it work on tf 2.7.3:

`from tensorFlow.keras.regularizers import L2

........

l2_reg = L2(self.lam) # inside build_graph function reg_var = l2_reg(self.weights) `

amithadiraju1694 avatar Feb 19 '22 19:02 amithadiraju1694