TensorFlow Placeholder Fix (#6852)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Fixed this error from happening when running this code:
tf.placeholder() is not compatible with eager execution.
at placeholder
raise RuntimeError("tf.placeholder() is not compatible with "
in array_ops.py: line 3341
at NetTrain
xs = tf.compat.v1.placeholder(tf.float32 in /QuantConnect/backtesting/./cache/algorithm/project/main.py: line 57
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from AlgorithmImports import *
|
||||
import tensorflow as tf
|
||||
import tensorflow.compat.v1 as tf
|
||||
|
||||
class TensorFlowNeuralNetworkAlgorithm(QCAlgorithm):
|
||||
|
||||
@@ -65,6 +65,7 @@ class TensorFlowNeuralNetworkAlgorithm(QCAlgorithm):
|
||||
y_data = np.array(self.prices_y[symbol]).astype(np.float32).reshape((-1,1))
|
||||
|
||||
# define placeholder for inputs to network
|
||||
tf.disable_v2_behavior()
|
||||
xs = tf.placeholder(tf.float32, [None, 1])
|
||||
ys = tf.placeholder(tf.float32, [None, 1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user