recently i am trying the PINN, i have read some codes, in this code, he didn't define the "model", the losses are directly applied on the weights and biases, so i want to ask if anybody know how to save weights and biases in this situation? Thanks! Here is some code:
def neural_net(X, weights, biases, A):
num_layers = len(weights) + 1
H = X
for l in range(0,num_layers-2):
W = weights[l]
b = biases[l]
H = tf.keras.activations.swish(20*A[l]*tf.add(tf.matmul(H, W), b))
W = weights[-1]
b = biases[-1]
Y = tf.add(tf.matmul(H, W), b)
return Y
grads1 = tape.gradient(loss, W + b + A, unconnected_gradients=tf.UnconnectedGradients.ZERO)
opt.apply_gradients(zip(grads1, W + b + A))
optimizer = tf.optimizers.Adam(learning_rate=0.0001)
we can see there is no define of model, so i dont know how to save the weigths and biases.
I want to save the weights and biases and then re use of them.