Please tell me more about placeholder and session deprecated in tensorflow 2.0

Asked 2 years ago, Updated 2 years ago, 59 views

I didn't understand the functions of placeholder and session even though I looked at various sites, so I don't know how to write the code directly in tensorflow 2.0.
I would like you to tell me not only the explanation but also the code using examples.
Also, besides these two, I would like you to tell me about the functions that disappeared in the sensorflow update.
I don't want to downgrade tensorflow or take over previous features.

python python3 tensorflow

2022-09-30 11:33

1 Answers

I've never used TensorFlow myself, so I'm just looking into it a little bit this time.

How to run a single-line notation CNN in Tensorflow2 - The following guides will be helpful in Qiita.

Migrate code for TensorFlow1 to TensorFlow2|TensorFlow Core

Method 1

Running 1.x code unmodified in TensorFlow 2.x is still possible (except contrib).

import tensorflow.compat.v1astftf.disable_v2_behavior()

However, this does not take advantage of many of the improvements added in TensorFlow 2.0.This guide covers code upgrades, further simplification, improved performance, and easier maintenance.

The following import statements in the existing code will be replaced by the above statement.

import tensorflow as tf

Method 2

Alternatively, as mentioned in the Qiita article above, there seems to be a way to change the description of the existing code to tf.compat.v1.*.

Change the API corresponding to the '1 Series' column in the code as described in '2 Series'.

There are other automated migration scripts available, so please read the TensorFlow guide.


2022-09-30 11:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.