fix cpx ut fail
@@ -60,16 +60,16 @@ def build_fake_yaml2():
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')
- z = tf.constant(np.random.random((1,1,1,1)), name='z')
+ graph_def = tf.compat.v1.GraphDef()
+ with tf.compat.v1.Session() as sess:
+ x = tf.compat.v1.placeholder(tf.float32, shape=(1,3,3,1), name='x')
+ y = tf.constant(np.random.random((2,2,1,1)).astype(np.float32), name='y')
+ z = tf.constant(np.random.random((1,1,1,1)).astype(np.float32), name='z')
op = tf.nn.conv2d(input=x, filters=y, strides=[1,1,1,1], padding='VALID', name='op_to_store')
op2 = tf.nn.conv2d(input=op, filters=z, strides=[1,1,1,1], padding='VALID', name='op2_to_store')
- sess.run(tf.global_variables_initializer())
- constant_graph = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['op2_to_store'])
+ sess.run(tf.compat.v1.global_variables_initializer())
+ constant_graph = tf.compat.v1.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['op2_to_store'])
graph_def.ParseFromString(constant_graph.SerializeToString())
with graph.as_default():
@@ -78,9 +78,9 @@ 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')
- z = tf.constant(np.random.random((1,1,1,1)), name='z')
+ x = tf.compat.v1.placeholder(tf.float32, shape=(1,3,3,1), name='x')
+ y = tf.constant(np.random.random((2,2,1,1)).astype(np.float32), name='y')
+ z = tf.constant(np.random.random((1,1,1,1)).astype(np.float32), name='z')
op = tf.nn.conv2d(input=x, filters=y, strides=[1,1,1,1], padding='VALID', name='op_to_store')
op2 = tf.nn.conv2d(input=op, filters=z, strides=[1,1,1,1], padding='VALID', name='op2_to_store')
