Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of tlx for nested structure network #29

Open
2 tasks
qiutzh opened this issue Oct 13, 2022 · 3 comments
Open
2 tasks

Support of tlx for nested structure network #29

qiutzh opened this issue Oct 13, 2022 · 3 comments

Comments

@qiutzh
Copy link

qiutzh commented Oct 13, 2022

New Issue Checklist

Issue Description

请问,tensorlayerx 目前支持 paddle 做后端,然后运行包含嵌套结构关系的网络模型吗?我运行 tlx 提供的 example 例子,发现 nested_usage_of_layer.py 这个文件以 tf 做后端可以运行,但改成 paddle 做后端,会提示报错,错误提示:

Traceback (most recent call last):
  File "D:/ProjectByPython/code/reference/DL_Platform/TensorLayer/TensorLayerX-0.5.6/examples/basic_tutorials/nested_usage_of_layer.py", line 159, in <module>
    grad = tape.gradient(_loss_ce, train_weights)
  File "D:\Software\miniconda3\envs\py37env_tlx\lib\site-packages\tensorflow_core\python\eager\backprop.py", line 984, in gradient
    if not t.dtype.is_floating:
AttributeError: 'paddle.fluid.core_avx.VarType' object has no attribute 'is_floating'

Reproducible Code

python: 3.7
paddlepaddle version: 2.3.0
tensorlayerx version: 0.5.6

代码就是例子中的 nested_usage_of_layer.py 这个文件。
nested_usage_of_layer.txt

自己在转换其它存在嵌套关系的网络模型时,如 resnet 时,发现以 paddle 做后端也可以成功运行,但是结果不准确,BatchNorm2d 这一层开始的输出就不再一样了。

@Laicheng0830
Copy link
Member

这个报错是正常的,nested_usage_of_layer.py 的代码是混合TF运行的,其中用到了tf.GradientTape()。

@Laicheng0830
Copy link
Member

qiutzh结果不准确能给个github仓链接吗,或者贴例子

@qiutzh
Copy link
Author

qiutzh commented Jan 16, 2023

@Laicheng0830 忘记回复您了,抱歉,嵌套结构的网络定义tensorlayerx也是支持的~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants