Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

reset all weights keras

  for layer in model.layers: 
    if isinstance(layer, tf.keras.Model):
      reset_weights(layer)
      continue
    for k, initializer in layer.__dict__.items():
      if "initializer" not in k:
        continue
      # find the corresponding variable
      var = getattr(layer, k.replace("_initializer", ""))
      var.assign(initializer(var.shape, var.dtype))
Comment

PREVIOUS NEXT
Code Example
Python :: Delete python text after 1 sec 
Python :: python get 1st arg 
Python :: numpy array serialize to string 
Python :: find total no of true in a list in python 
Python :: create table pyspark sql 
Python :: list length in python 
Python :: roc auc score plotting 
Python :: how to get the index of the first integer in a string python 
Python :: insert list python 
Python :: is vs == python 
Python :: python single line if 
Python :: fastapi oauth2 
Python :: python number of elements in list of lists 
Python :: how to host python flask web application 
Python :: range function 
Python :: Python message popup 
Python :: how to code a yes or no question in python v3.8 
Python :: python remove spaces from string 
Python :: check status code urllib open 
Python :: cufflink install python jupyter 
Python :: if string in list python 
Python :: how to hide ticks marks in plot 
Python :: matplotlib remove duplicate legend entries from plotting loop 
Python :: python re.search() 
Python :: divide every element in numpy array 
Python :: python check if input() gives error 
Python :: K-Means Clustering in Python – 3 clusters 
Python :: Class In Python With Instance Method 
Python :: sns histplot 
Python :: print colored text to console python 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =