Add files via upload
This commit is contained in:
parent
31e7f76672
commit
b709df5840
2 changed files with 9 additions and 1 deletions
|
|
@ -109,6 +109,10 @@ def RPN_to_pytorch(pathdir,filename, math_expr, lr = 1e-2, N_epochs = 500):
|
||||||
trainable_parameters[j] -= lr * trainable_parameters[j].grad
|
trainable_parameters[j] -= lr * trainable_parameters[j].grad
|
||||||
trainable_parameters[j].grad.zero_()
|
trainable_parameters[j].grad.zero_()
|
||||||
|
|
||||||
|
for nan_i in range(len(trainable_parameters)):
|
||||||
|
if torch.isnan(trainable_parameters[nan_i])==True or abs(trainable_parameters[nan_i])>1e7:
|
||||||
|
return 1000000, 10000000, "1"
|
||||||
|
|
||||||
ii = -1
|
ii = -1
|
||||||
for parm in unsnapped_param_dict:
|
for parm in unsnapped_param_dict:
|
||||||
if ii == -1:
|
if ii == -1:
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,11 @@ def final_gd(pathdir,filename, math_expr, lr = 1e-2, N_epochs = 5000):
|
||||||
for j in range(N_params-1):
|
for j in range(N_params-1):
|
||||||
trainable_parameters[j] -= lr/10 * trainable_parameters[j].grad
|
trainable_parameters[j] -= lr/10 * trainable_parameters[j].grad
|
||||||
trainable_parameters[j].grad.zero_()
|
trainable_parameters[j].grad.zero_()
|
||||||
|
|
||||||
|
for nan_i in range(len(trainable_parameters)):
|
||||||
|
if torch.isnan(trainable_parameters[nan_i])==True or abs(trainable_parameters[nan_i])>1e7:
|
||||||
|
return 1000000, 10000000, "1"
|
||||||
|
|
||||||
# get the updated symbolic regression
|
# get the updated symbolic regression
|
||||||
ii = -1
|
ii = -1
|
||||||
for parm in unsnapped_param_dict:
|
for parm in unsnapped_param_dict:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue