The functions in sub and mul in the official TensorFlow document have been renamed in the API

Source: Internet
Author: User
Tags mul

The following two issues were encountered in TensorFlow Chinese document Learning TensorFlow in TensorFlow official documents and Geek College:

1) attributeerror:module ' TensorFlow ' has no attribute ' sub '
# Enter an interactive tensorflow session Import  == tf. Variable ([1.0,2.0= tf.constant ([3.0,3.0])# initializes ' x ' with the Run () method of the initializer Initalizer op X.initializer.run () # Add a Subtraction sub op, subtract ' a ' from ' X ', run minus op, output sub = tf.sub (x,a)print(Sub.eval () ) # task complete, close reply Sess.close ()

Executive Times Error:

Traceback (most recent):   " c:/pythonproj/tensorflow/first_tensorflow.py "  in <module>    ='tensorflow '  Sub'

After the pycharm in the TF. Auto-echo information, I found that this sub function has been replaced by subtract, replaced by Tf.subtract (x,a), OK, all smooth!

2) Attributeerror:module ' TensorFlow ' has no attribute ' mul '
INPUT1 = tf.constant (3.0= tf.constant (2.0= tf.constant (5.0== Tf.mul (INPUT1, intermed) with TF. Session () as sess:    = Sess.run ([mul,intermed])    print(Result)

The error message is:

Traceback (most recent):   " c:/pythonproj/tensorflow/first_tensorflow.py "  in <module>    ='tensorflow '  Mul'

In the same vein, after the observation of the pycharm in TF, I found that the Tf.mul function has been replaced by tf.multiply, modified, ok!

The functions in sub and mul in the official TensorFlow document have been renamed in the API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.