[TensorFlow 2.0] Test failures while running the Tensor Flow frontend test_forward.py function

TVM: Latest Python Version: 3.6.10 TensorFlow: 2.6.0

I’m running the python file tests/python/frontend/tensorflow/test_forward.py and getting the following errors.

test_tensor_array_split: → AssertionError: TensorArrayReadV3 is not in graph

tests/python/frontend/tensorflow/test_forward.py:1470: in run
    compare_tf_with_tvm([], [], "TensorArrayReadV3:0", mode="vm")
tests/python/frontend/tensorflow/test_forward.py:247: in compare_tf_with_tvm
    if add_shapes_to_graph_def
python/tvm/relay/testing/tf.py:139: in AddShapesToGraphDef
    convert_to_list(out_node),
../../.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:346: in new_func
    return func(*args, **kwargs)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/graph_util_impl.py:281: in convert_variables_to_constants
    variable_names_denylist=variable_names_blacklist)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py:1282: in convert_variables_to_constants_from_session_graph
    variable_names_denylist=variable_names_denylist))
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py:927: in __init__
    graph_def = graph_util.extract_sub_graph(graph_def, output_node_names)
../../.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:346: in new_func
    return func(*args, **kwargs)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/graph_util_impl.py:209: in extract_sub_graph

test_tensor_array_concat: → NotImplementedError: The following operators are not implemented: {‘TensorListConcatV2’, ‘TensorListSplit’}

tests/python/frontend/tensorflow/test_forward.py:1470: in run
    compare_tf_with_tvm([], [], "TensorArrayReadV3:0", mode="vm")
tests/python/frontend/tensorflow/test_forward.py:247: in compare_tf_with_tvm
    if add_shapes_to_graph_def
python/tvm/relay/testing/tf.py:139: in AddShapesToGraphDef
    convert_to_list(out_node),
../../.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:346: in new_func
    return func(*args, **kwargs)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/graph_util_impl.py:281: in convert_variables_to_constants
    variable_names_denylist=variable_names_blacklist)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py:1282: in convert_variables_to_constants_from_session_graph
    variable_names_denylist=variable_names_denylist))
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py:927: in __init__
    graph_def = graph_util.extract_sub_graph(graph_def, output_node_names)
../../.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py:346: in new_func
    return func(*args, **kwargs)
../../.local/lib/python3.6/site-packages/tensorflow/python/framework/graph_util_impl.py:209: in extract_sub_graph
    _assert_nodes_are_present(name_to_node, dest_nodes)

I run into then same issue, even with docker image tlcpack/ci-gpu:v0.81

It turns out the graph_def generated by tensorflow in this case is using TensorArrayV2. I don’t know why it is ok in CI

node {
  name: "TensorArrayV2Read/TensorListGetItem"
  op: "TensorListGetItem"
  input: "TensorArrayV2Write_1/TensorListSetItem"
  input: "TensorArrayV2Read/TensorListGetItem/index"
  input: "TensorArrayV2Read/TensorListGetItem/element_shape"
  attr {
    key: "element_dtype"
    value {
      type: DT_FLOAT
    }
  }
}
versions {
  producer: 561
}

According to this code https://github.com/tensorflow/tensorflow/blob/20f44e94dcf480690d3e88606fa66e0862bd580e/tensorflow/python/ops/tensor_array_ops.py#L1074

It seems TF goes to TensorArrayV2 path, so call tf.disable_control_flow_v2() can workaround this issue

I looked into this a bit, with the versions matching CI (Python 3.6, Tensorflow 2.4.2) it looks like in CI this line tf.disable_v2_behavior() in test_debugging.py is executed before this test, which I’m guessing is setting some globals inside Tensorflow that are affecting later tests (such as the one in this post), which is why it passes in CI. Looking at the order of test execution test_debugging.py is run before test_forward.py in a full CI run:

tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_control_flow.py::test_vanilla_loop
tests/python/frontend/tensorflow/test_control_flow.py::test_callnode_loop_vars
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_2_vars
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_3_vars
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_conditions
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_bodies
tests/python/frontend/tensorflow/test_control_flow.py::test_nested_loop
tests/python/frontend/tensorflow/test_control_flow.py::test_vanilla_cond
tests/python/frontend/tensorflow/test_control_flow.py::test_multiple_cond_vars
tests/python/frontend/tensorflow/test_control_flow.py::test_cond_fn_parameters
tests/python/frontend/tensorflow/test_control_flow.py::test_nested_cond
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_in_cond
tests/python/frontend/tensorflow/test_control_flow.py::test_cond_in_loop
tests/python/frontend/tensorflow/test_control_flow.py::test_vanilla_loop_bound
tests/python/frontend/tensorflow/test_control_flow.py::test_nested_loop_bound
tests/python/frontend/tensorflow/test_control_flow.py::test_switch
tests/python/frontend/tensorflow/test_control_flow.py::test_loop_tuple_input
tests/python/frontend/tensorflow/test_debugging.py::test_assert_true
tests/python/frontend/tensorflow/test_debugging.py::test_assert_true_var_capture
tests/python/frontend/tensorflow/test_debugging.py::test_assert_false
tests/python/frontend/tensorflow/test_forward.py::test_forward_pooling
tests/python/frontend/tensorflow/test_forward.py::test_forward_convolution
tests/python/frontend/tensorflow/test_forward.py::test_forward_convolution3d
tests/python/frontend/tensorflow/test_forward.py::test_forward_convolution3d_transpose
tests/python/frontend/tensorflow/test_forward.py::test_forward_biasadd
tests/python/frontend/tensorflow/test_forward.py::test_forward_argwhere
tests/python/frontend/tensorflow/test_forward.py::test_forward_space_to_batch_nd
tests/python/frontend/tensorflow/test_forward.py::test_forward_batch_to_space_nd
tests/python/frontend/tensorflow/test_forward.py::test_forward_reshape
tests/python/frontend/tensorflow/test_forward.py::test_forward_depthtospace
tests/python/frontend/tensorflow/test_forward.py::test_forward_spacetodepth
tests/python/frontend/tensorflow/test_forward.py::test_forward_squeeze
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_write_read
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_scatter
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_gather
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_split
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_concat
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_size
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_stack
tests/python/frontend/tensorflow/test_forward.py::test_tensor_array_unstack
tests/python/frontend/tensorflow/test_forward.py::test_forward_concat_v2
tests/python/frontend/tensorflow/test_forward.py::test_forward_sigmoid
tests/python/frontend/tensorflow/test_forward.py::test_forward_argminmax
tests/python/frontend/tensorflow/test_forward.py::test_forward_variable
tests/python/frontend/tensorflow/test_forward.py::test_read_variable_op[llvm]
tests/python/frontend/tensorflow/test_forward.py::test_read_variable_op[cuda]
tests/python/frontend/tensorflow/test_forward.py::test_forward_matmul
tests/python/frontend/tensorflow/test_forward.py::test_forward_batch_matmul
tests/python/frontend/tensorflow/test_forward.py::test_forward_batch_matmul_dynamic
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_dense_matmul
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np0-sparse_values_np0-dense_shape_np0-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np1-sparse_values_np1-dense_shape_np1-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np2-sparse_values_np2-dense_shape_np2-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np3-sparse_values_np3-dense_shape_np3-5]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np4-sparse_values_np4-dense_shape_np4-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np5-sparse_values_np5-dense_shape_np5-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[True-sparse_indices_np6-sparse_values_np6-dense_shape_np6-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np0-sparse_values_np0-dense_shape_np0-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np1-sparse_values_np1-dense_shape_np1-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np2-sparse_values_np2-dense_shape_np2-10]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np3-sparse_values_np3-dense_shape_np3-5]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np4-sparse_values_np4-dense_shape_np4-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np5-sparse_values_np5-dense_shape_np5-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_fill_empty_rows[False-sparse_indices_np6-sparse_values_np6-dense_shape_np6-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np0-sparse_values_np0-prev_shape_np0-new_shape_np0]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np1-sparse_values_np1-prev_shape_np1-new_shape_np1]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np2-sparse_values_np2-prev_shape_np2-new_shape_np2]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np3-sparse_values_np3-prev_shape_np3-new_shape_np3]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np4-sparse_values_np4-prev_shape_np4-new_shape_np4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np5-sparse_values_np5-prev_shape_np5-new_shape_np5]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np6-sparse_values_np6-prev_shape_np6-new_shape_np6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np7-sparse_values_np7-prev_shape_np7-new_shape_np7]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np8-sparse_values_np8-prev_shape_np8-new_shape_np8]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[True-sparse_indices_np9-sparse_values_np9-prev_shape_np9-new_shape_np9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np0-sparse_values_np0-prev_shape_np0-new_shape_np0]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np1-sparse_values_np1-prev_shape_np1-new_shape_np1]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np2-sparse_values_np2-prev_shape_np2-new_shape_np2]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np3-sparse_values_np3-prev_shape_np3-new_shape_np3]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np4-sparse_values_np4-prev_shape_np4-new_shape_np4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np5-sparse_values_np5-prev_shape_np5-new_shape_np5]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np6-sparse_values_np6-prev_shape_np6-new_shape_np6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np7-sparse_values_np7-prev_shape_np7-new_shape_np7]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np8-sparse_values_np8-prev_shape_np8-new_shape_np8]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_reshape[False-sparse_indices_np9-sparse_values_np9-prev_shape_np9-new_shape_np9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-True-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sum-False-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-True-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_sqrt_n-False-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-True-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np0-indices_np0-segment_ids_np0-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np1-indices_np1-segment_ids_np1-4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np2-indices_np2-segment_ids_np2-100]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np3-indices_np3-segment_ids_np3-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np4-indices_np4-segment_ids_np4-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np5-indices_np5-segment_ids_np5-9]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np6-indices_np6-segment_ids_np6-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np7-indices_np7-segment_ids_np7-None]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_segment_sum_variants[sparse_segment_mean-False-data_np8-indices_np8-segment_ids_np8-6]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[True-data_np0-segment_ids_np0]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[True-data_np1-segment_ids_np1]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[True-data_np2-segment_ids_np2]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[True-data_np3-segment_ids_np3]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[True-data_np4-segment_ids_np4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[False-data_np0-segment_ids_np0]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[False-data_np1-segment_ids_np1]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[False-data_np2-segment_ids_np2]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[False-data_np3-segment_ids_np3]
tests/python/frontend/tensorflow/test_forward.py::test_forward_math_segment_sum[False-data_np4-segment_ids_np4]
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_to_dense
tests/python/frontend/tensorflow/test_forward.py::test_forward_sparse_to_dense_v2
tests/python/frontend/tensorflow/test_forward.py::test_sparse_add
tests/python/frontend/tensorflow/test_forward.py::test_forward_stridedslice
tests/python/frontend/tensorflow/test_forward.py::test_forward_divide
tests/python/frontend/tensorflow/test_forward.py::test_forward_floormod
tests/python/frontend/tensorflow/test_forward.py::test_forward_truncatemod
tests/python/frontend/tensorflow/test_forward.py::test_forward_gather
tests/python/frontend/tensorflow/test_forward.py::test_forward_gather_nd
tests/python/frontend/tensorflow/test_forward.py::test_forward_bias_add
tests/python/frontend/tensorflow/test_forward.py::test_forward_split
tests/python/frontend/tensorflow/test_forward.py::test_forward_top_k_v2
tests/python/frontend/tensorflow/test_forward.py::test_forward_unstack
tests/python/frontend/tensorflow/test_forward.py::test_forward_tile
tests/python/frontend/tensorflow/test_forward.py::test_forward_clip_by_value
tests/python/frontend/tensorflow/test_forward.py::test_forward_multi_input
tests/python/frontend/tensorflow/test_forward.py::test_forward_multi_output
tests/python/frontend/tensorflow/test_forward.py::test_forward_resize
tests/python/frontend/tensorflow/test_forward.py::test_forward_broadcast_args
tests/python/frontend/tensorflow/test_forward.py::test_forward_broadcast_to
tests/python/frontend/tensorflow/test_forward.py::test_forward_fill
tests/python/frontend/tensorflow/test_forward.py::test_forward_crop
tests/python/frontend/tensorflow/test_forward.py::test_forward_crop_and_resize
tests/python/frontend/tensorflow/test_forward.py::test_forward_nms
tests/python/frontend/tensorflow/test_forward.py::test_forward_combined_nms
tests/python/frontend/tensorflow/test_forward.py::test_forward_lstm
tests/python/frontend/tensorflow/test_forward.py::test_forward_pack
tests/python/frontend/tensorflow/test_forward.py::test_forward_unpack
tests/python/frontend/tensorflow/test_forward.py::test_forward_range
tests/python/frontend/tensorflow/test_forward.py::test_forward_pad
tests/python/frontend/tensorflow/test_forward.py::test_logical_and
tests/python/frontend/tensorflow/test_forward.py::test_logical_or
tests/python/frontend/tensorflow/test_forward.py::test_logical_xor
tests/python/frontend/tensorflow/test_forward.py::test_logical_not
tests/python/frontend/tensorflow/test_forward.py::test_forward_logical
tests/python/frontend/tensorflow/test_forward.py::test_forward_where
tests/python/frontend/tensorflow/test_forward.py::test_forward_inception_v3
tests/python/frontend/tensorflow/test_forward.py::test_forward_inception_v1
tests/python/frontend/tensorflow/test_forward.py::test_forward_mobilenet
tests/python/frontend/tensorflow/test_forward.py::test_forward_resnetv2
tests/python/frontend/tensorflow/test_forward.py::test_forward_ssd
tests/python/frontend/tensorflow/test_forward.py::test_forward_placeholder
tests/python/frontend/tensorflow/test_forward.py::test_forward_ptb
tests/python/frontend/tensorflow/test_forward.py::test_forward_lrn
tests/python/frontend/tensorflow/test_forward.py::test_forward_l2_normalize
tests/python/frontend/tensorflow/test_forward.py::test_forward_transpose
tests/python/frontend/tensorflow/test_forward.py::test_forward_slice
tests/python/frontend/tensorflow/test_forward.py::test_forward_ceil
tests/python/frontend/tensorflow/test_forward.py::test_forward_floor
tests/python/frontend/tensorflow/test_forward.py::test_forward_relu
tests/python/frontend/tensorflow/test_forward.py::test_forward_leaky_relu
tests/python/frontend/tensorflow/test_forward.py::test_forward_elu
tests/python/frontend/tensorflow/test_forward.py::test_forward_selu
tests/python/frontend/tensorflow/test_forward.py::test_forward_tanh
tests/python/frontend/tensorflow/test_forward.py::test_forward_softmax
tests/python/frontend/tensorflow/test_forward.py::test_forward_round
tests/python/frontend/tensorflow/test_forward.py::test_forward_abs
tests/python/frontend/tensorflow/test_forward.py::test_forward_zeros_like
tests/python/frontend/tensorflow/test_forward.py::test_forward_squared_difference
tests/python/frontend/tensorflow/test_forward.py::test_forward_reverse_v2
tests/python/frontend/tensorflow/test_forward.py::test_forward_sign
tests/python/frontend/tensorflow/test_forward.py::test_forward_square
tests/python/frontend/tensorflow/test_forward.py::test_forward_pow_exp
tests/python/frontend/tensorflow/test_forward.py::test_forward_unary
tests/python/frontend/tensorflow/test_forward.py::test_forward_atan2
tests/python/frontend/tensorflow/test_forward.py::test_forward_expm1
tests/python/frontend/tensorflow/test_forward.py::test_forward_softsign
tests/python/frontend/tensorflow/test_forward.py::test_forward_rint
tests/python/frontend/tensorflow/test_forward.py::test_forward_negative
tests/python/frontend/tensorflow/test_forward.py::test_forward_log_softmax
tests/python/frontend/tensorflow/test_forward.py::test_forward_softplus
tests/python/frontend/tensorflow/test_forward.py::test_forward_rsqrt
tests/python/frontend/tensorflow/test_forward.py::test_forward_sqrt
tests/python/frontend/tensorflow/test_forward.py::test_forward_right_shift
tests/python/frontend/tensorflow/test_forward.py::test_forward_left_shift
tests/python/frontend/tensorflow/test_forward.py::test_forward_mean
tests/python/frontend/tensorflow/test_forward.py::test_forward_size
tests/python/frontend/tensorflow/test_forward.py::test_forward_reduce
tests/python/frontend/tensorflow/test_forward.py::test_forward_raw_reduce
tests/python/frontend/tensorflow/test_forward.py::test_forward_rel_ops
tests/python/frontend/tensorflow/test_forward.py::test_forward_expand_dims
tests/python/frontend/tensorflow/test_forward.py::test_forward_maximum
tests/python/frontend/tensorflow/test_forward.py::test_forward_minimum
tests/python/frontend/tensorflow/test_forward.py::test_placeholder
tests/python/frontend/tensorflow/test_forward.py::test_forward_one_hot
tests/python/frontend/tensorflow/test_forward.py::test_forward_add_n
tests/python/frontend/tensorflow/test_forward.py::test_sharing_node
tests/python/frontend/tensorflow/test_forward.py::test_forward_unravel_index
tests/python/frontend/tensorflow/test_forward.py::test_forward_dilation
tests/python/frontend/tensorflow/test_forward.py::test_forward_identityn[data_np_list0]
tests/python/frontend/tensorflow/test_forward.py::test_forward_identityn[data_np_list1]
tests/python/frontend/tensorflow/test_forward.py::test_forward_identityn[data_np_list2]
tests/python/frontend/tensorflow/test_forward.py::test_forward_isinf
tests/python/frontend/tensorflow/test_forward.py::test_forward_isfinite
tests/python/frontend/tensorflow/test_forward.py::test_forward_isnan
tests/python/frontend/tensorflow/test_forward.py::test_forward_spop
tests/python/frontend/tensorflow/test_forward.py::test_forward_dynamic_input_shape
tests/python/frontend/tensorflow/test_forward.py::test_forward_dynmaic_rnn_lstmblockcell
tests/python/frontend/tensorflow/test_forward.py::test_forward_unique
tests/python/frontend/tensorflow/test_forward.py::test_forward_unique_with_counts
tests/python/frontend/tensorflow/test_forward.py::test_moments
tests/python/frontend/tensorflow/test_forward.py::test_invert_permutation
tests/python/frontend/tensorflow/test_no_op.py::test_no_op
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
tests/python/frontend/tensorflow/test_bn_dynamic.py::test_fused_batch_norm
/workspace/tests/python/frontend/tensorflow/test_bn_dynamic.py:68:
tests/python/frontend/tensorflow/test_control_flow.py:
tests/python/frontend/tensorflow/test_forward.py:
tests/python/frontend/tensorflow/test_forward.py:
/workspace/tests/python/frontend/tensorflow/test_forward.py:181:
tests/python/frontend/tensorflow/test_forward.py::test_forward_inception_v1
/workspace/tests/python/frontend/tensorflow/test_forward.py:3804:
tests/python/frontend/tensorflow/test_forward.py::test_forward_inception_v1
tests/python/frontend/tensorflow/test_forward.py::test_forward_inception_v1
tests/python/frontend/tensorflow/test_forward.py::test_forward_ptb
/workspace/tests/python/frontend/tensorflow/test_forward.py:4016:

Adding disable_v2_behavior to the individual test has a similar effect to disable_control_flow_v2 like you mentioned. The fix should be simple (call that in every test instead), a PR will be incoming soon.

1 Like

I think we can use the same pattern in test_forward.py to make it compatible with tensorflow 1.x

try:
    import tensorflow.compat.v1 as tf

    tf.disable_v2_behavior()
except ImportError:
    import tensorflow as tf

Yup that’s exactly what https://github.com/apache/tvm/pull/10204 does :slight_smile:, thanks for digging into this!