def copy_weights(teacher_model, student_model, layer_names):
 for name in layer_names:
  weights = teacher_model.get_layer(name=name).get_weights()
  student_model.get_layer(name=name).set_weights(weights)

def copy_weights ( teacher_model , student_model , layer_names ) : for name in layer_names : weights = teacher_model . get_layer ( name = name ) . get_weights ( ) student_model . get_layer ( name = name ) . set_weights ( weights )
copy weights from teacher_model to student_model .