0

I run version 1.8 of TensorFlow on Python 3.

I am getting the following exception:

import tensorflow as tf

Matrix_one = tf.constant([[2,3],[3,4]])

with tf.Session() as session:

    print(session.run(tf.math.log(Matrix_one)))

AttributeError: module 'tensorflow.tools.api.generator.api.math' has no attribute 'log'
1
  • I cannot reproduce your results. Check the version using print (tf.__version__) Commented Oct 24, 2018 at 7:23

1 Answer 1

3
import tensorflow as tf

Matrix_one = tf.constant([[2,3],[3,4]],dtype=tf.float32)

with tf.Session() as session:

    print(session.run(tf.log(Matrix_one)))

The result is as follows: [[0.6931472 1.0986123] [1.0986123 1.3862944]]

    tf.log(
        x,
        name=None
    )
The parameter x must be one of the following types:

bfloat16, half, float32, float64, complex64, complex128

At version 1.11 and above, the tf.math.log function is available because tensorflow moves the base arithmetic operator into tf.math.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.