Skip to content

AttributeError: module 'tensorflow' has no attribute 'trainable_variables' #50

@xyy386

Description

@xyy386

Dear Lu

/Users/xingyiyao/anaconda3/envs/master/bin/python /Users/xingyiyao/Desktop/deeponet-master/src/deeponet_pde.py
Using backend: tensorflow.compat.v1
Other supported backends: tensorflow, pytorch, jax, paddle.
paddle supports more examples now and is recommended.
WARNING:tensorflow:From /Users/xingyiyao/anaconda3/envs/master/lib/python3.9/site-packages/tensorflow/python/compat/v2_compat.py:98: disable_resource_variables (from tensorflow.python.ops.resource_variables_toggle) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Generating operator data...
'gen_operator_data' took 24.675491 s

Generating operator data...
'gen_operator_data' took 220.363219 s

Compiling model...
Building DeepONet...
'build' took 0.018863 s

'compile' took 0.052497 s

Warning: epochs is deprecated and will be removed in a future version. Use iterations instead.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1741276735.336720 297667 mlir_graph_optimization_pass.cc:401] MLIR V1 optimization pass is not enabled
Training model...

Step Train loss Test loss Test metric
0 [1.16e+00] [1.18e+00] [1.15e+00]
1000 [4.93e-04] [5.21e-04] [4.99e-04]
2000 [1.28e-04] [1.44e-04] [1.37e-04]
3000 [6.29e-05] [7.29e-05] [6.95e-05]
4000 [4.13e-05] [4.77e-05] [4.55e-05]
5000 [2.93e-05] [3.41e-05] [3.24e-05]
6000 [2.18e-05] [2.54e-05] [2.41e-05]
7000 [1.55e-05] [1.80e-05] [1.70e-05]
8000 [1.21e-05] [1.40e-05] [1.34e-05]
9000 [1.17e-05] [1.32e-05] [1.27e-05]
10000 [9.23e-06] [1.06e-05] [1.02e-05]
11000 [8.02e-06] [9.18e-06] [8.82e-06]
12000 [7.33e-06] [8.36e-06] [8.01e-06]
13000 [6.83e-06] [7.77e-06] [7.44e-06]
14000 [8.15e-06] [8.94e-06] [8.56e-06]
15000 [1.02e-05] [1.13e-05] [1.09e-05]
16000 [6.31e-06] [7.23e-06] [6.87e-06]
17000 [5.10e-06] [5.72e-06] [5.38e-06]
18000 [3.52e-06] [4.02e-06] [3.72e-06]
19000 [3.62e-06] [4.01e-06] [3.69e-06]
20000 [3.01e-06] [3.39e-06] [3.09e-06]
21000 [3.60e-06] [4.15e-06] [3.84e-06]
22000 [4.67e-06] [5.09e-06] [4.78e-06]
23000 [4.52e-06] [5.03e-06] [4.71e-06]
24000 [7.31e-06] [7.80e-06] [7.44e-06]
25000 [9.30e-06] [9.95e-06] [9.51e-06]
26000 [7.70e-06] [8.37e-06] [7.93e-06]
27000 [2.42e-06] [2.78e-06] [2.48e-06]
28000 [4.39e-06] [4.78e-06] [4.44e-06]
29000 [6.74e-06] [6.97e-06] [6.57e-06]
30000 [3.03e-06] [3.34e-06] [3.05e-06]
31000 [4.80e-06] [5.05e-06] [4.71e-06]
32000 [5.89e-06] [6.28e-06] [5.89e-06]
33000 [3.29e-06] [3.54e-06] [3.24e-06]
34000 [3.53e-06] [3.87e-06] [3.59e-06]
35000 [6.98e-06] [7.42e-06] [7.05e-06]
36000 [2.78e-06] [3.00e-06] [2.71e-06]
37000 [3.11e-06] [3.35e-06] [3.07e-06]
38000 [3.77e-06] [3.97e-06] [3.64e-06]
39000 [2.31e-06] [2.49e-06] [2.20e-06]
40000 [2.71e-06] [2.94e-06] [2.63e-06]
41000 [2.59e-06] [2.77e-06] [2.45e-06]
42000 [2.95e-06] [3.11e-06] [2.79e-06]
43000 [2.98e-06] [3.27e-06] [2.98e-06]
44000 [2.03e-06] [2.22e-06] [1.93e-06]
45000 [1.62e-06] [1.79e-06] [1.52e-06]
46000 [1.99e-06] [2.25e-06] [1.97e-06]
47000 [3.66e-06] [3.83e-06] [3.49e-06]
48000 [4.13e-06] [4.44e-06] [4.12e-06]
49000 [5.19e-06] [5.25e-06] [4.87e-06]
50000 [2.05e-06] [2.21e-06] [1.94e-06]

Best model at step 45000:
train loss: 1.62e-06
test loss: 1.79e-06
test metric: [1.52e-06]

'train' took 148.098903 s

Traceback (most recent call last):
File "/Users/xingyiyao/Desktop/deeponet-master/src/deeponet_pde.py", line 287, in
main()
File "/Users/xingyiyao/Desktop/deeponet-master/src/deeponet_pde.py", line 283, in main
run(problem, system, space, T, m, nn, net, lr, epochs, num_train, num_test)
File "/Users/xingyiyao/Desktop/deeponet-master/src/deeponet_pde.py", line 175, in run
print("# Parameters:", np.sum([np.prod(v.shape) for v in tf.keras.backend.trainable_variables()]))
AttributeError: module 'tensorflow' has no attribute 'trainable_variables'

进程已结束,退出代码为 1

there are some wrong about tensor flow ,could you mind telling me how to solve it?I will appreciate it if you can reply me.

Honestly
Xyy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions