Skip to content

Support of tlx for nested structure network #29

Open

Description

@qiutzh

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 这一层开始的输出就不再一样了。

Activity

  1. Laicheng0830 commented on Oct 13, 2022

    @Laicheng0830
    Member

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

  2. Laicheng0830 commented on Oct 13, 2022

    @Laicheng0830
    Member

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

  3. qiutzh commented on Jan 16, 2023

    @qiutzh
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions