Fix the tpe ut issue under tf1.15.2.
@@ -4,7 +4,6 @@ import unittest
import os
import yaml
import tensorflow as tf
-import importlib
def build_fake_yaml():
fake_yaml = '''
@@ -62,9 +61,12 @@ def build_fake_model():
try:
graph = tf.Graph()
graph_def = tf.GraphDef()
+
with tf.Session() as sess:
- x = tf.placeholder(tf.float64, shape=(1,3,3,1), name='x')
- y = tf.constant(np.random.random((2,2,1,1)), name='y')
+ x = tf.placeholder(tf.float32, shape=(1,3,3,1), name='x')
+ y = tf.constant(np.random.random((2,2,1,1)), name='y', dtype=tf.float32)
+ if tf.version.VERSION < '2.1.0':
+ x = tf.nn.relu(x)
op = tf.nn.conv2d(input=x, filter=y, strides=[1,1,1,1], padding='VALID', name='op_to_store')
sess.run(tf.global_variables_initializer())
@@ -77,8 +79,10 @@ def build_fake_model():
graph = tf.Graph()
graph_def = tf.compat.v1.GraphDef()
with tf.compat.v1.Session() as sess:
- x = tf.compat.v1.placeholder(tf.float64, shape=(1,3,3,1), name='x')
- y = tf.compat.v1.constant(np.random.random((2,2,1,1)), name='y')
+ x = tf.compat.v1.placeholder(tf.float32, shape=(1,3,3,1), name='x')
+ y = tf.compat.v1.constant(np.random.random((2,2,1,1)), name='y', dtype=tf.float32)
+ if tf.version.VERSION < '2.1.0':
+ x = tf.nn.relu(x)
op = tf.nn.conv2d(input=x, filters=y, strides=[1,1,1,1], padding='VALID', name='op_to_store')
sess.run(tf.compat.v1.global_variables_initializer())
