GithubHelp home page GithubHelp logo

为什么我的tensorflow2.0不支持python的if 还有while 这些语句,即使我加了@tf.function about tensorflow2_tutorials_chinese HOT 4 OPEN

czy36mengfei avatar czy36mengfei commented on May 7, 2024
为什么我的tensorflow2.0不支持python的if 还有while 这些语句,即使我加了@tf.function

from tensorflow2_tutorials_chinese.

Comments (4)

czy36mengfei avatar czy36mengfei commented on May 7, 2024

image
你那边说的不支持是什么意思,功能无效吗?发一下具体代码。
我这边可以正常运行

from tensorflow2_tutorials_chinese.

yuanzhoulvpi2017 avatar yuanzhoulvpi2017 commented on May 7, 2024

image
出现这个结果,
TypeError: Using a tf.Tensor as a Python bool is not allowed. Use if t is not None: instead of if t: to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.
我这个是2.0哇,不知道为什么,

from tensorflow2_tutorials_chinese.

czy36mengfei avatar czy36mengfei commented on May 7, 2024

可能命令行单条输入,它不能事先构造好图直接执行了。喜欢交互式输入欢迎使用jupyter-notebook,你会喜欢上它的

from tensorflow2_tutorials_chinese.

yuanzhoulvpi2017 avatar yuanzhoulvpi2017 commented on May 7, 2024

原来是这个原因,我回去用jupyter-notebook试一试,不能在命令行使用,算不算bug?

from tensorflow2_tutorials_chinese.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.