Code Monkey home page Code Monkey logo

Comments (1)

ShHsLin avatar ShHsLin commented on August 26, 2024

tf.log(tf.float32) --> return tf.float32
And therefore, if x < 0 and with type tf.float32,
tf.log(x) would output nan

See example below

(Pdb) tf.log(-1)
*** TypeError: Value passed to parameter 'x' has DataType int32 not in list of allowed values: float16, bfloat16, float32, float64, complex64, complex128
(Pdb) tf.log(-1+1j)
<tf.Tensor 'Log_2:0' shape=() dtype=complex128>
(Pdb) tf.log(-1.)
<tf.Tensor 'Log_3:0' shape=() dtype=float32>
(Pdb) tf.log(-1.+0)
<tf.Tensor 'Log_4:0' shape=() dtype=float32>
(Pdb) tf.log(-1.+0j)
<tf.Tensor 'Log_5:0' shape=() dtype=complex128>
(Pdb) tf.log(-2.)
<tf.Tensor 'Log_6:0' shape=() dtype=float32>
(Pdb) tf.log(tf.cast(-1.+0j), tf.complex64)
*** TypeError: cast() missing 1 required positional argument: 'dtype'
(Pdb) tf.log(tf.cast(-1.+0j), dtype=tf.complex64)
*** TypeError: cast() missing 1 required positional argument: 'dtype'
(Pdb) tf.log(tf.cast(-1.+0j, dtype=tf.complex64))
<tf.Tensor 'Log_7:0' shape=() dtype=complex64>
(Pdb) sess=tf.InteractiveSession()
(Pdb) sess.run(tf.log(-1))
*** TypeError: Value passed to parameter 'x' has DataType int32 not in list of allowed values: float16, bfloat16, float32, float64, complex64, complex128
(Pdb) sess.run(tf.log(-1.))
nan

from neural-network-quantum-state.

Related Issues (4)

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.