From d0a4cd4fe73ef26eeec6b7b3c99e797528c6a742 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 7 Aug 2019 22:39:48 -0700 Subject: [PATCH] Remove dependency on Python3 --- python/tvm/relay/frontend/tensorflow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/tvm/relay/frontend/tensorflow.py b/python/tvm/relay/frontend/tensorflow.py index 85eb0fd77dcc..c3ea1a662735 100644 --- a/python/tvm/relay/frontend/tensorflow.py +++ b/python/tvm/relay/frontend/tensorflow.py @@ -21,7 +21,6 @@ import warnings from collections import defaultdict -from functools import reduce # Numpy support import numpy as np @@ -457,7 +456,10 @@ def _impl(inputs, attr, params): # reshape n-dimensional batch matmul into 3d if len(orig_shape_x) > 3: outer_dims = [orig_shape_x[i] for i in range(0, len(orig_shape_x) - 2)] - num_outer_elts = reduce((lambda x, y: x * y), outer_dims) + num_outer_elts = 1 + for outer_dim in outer_dims: + num_outer_elts *= outer_dim + new_shape_x = (num_outer_elts, orig_shape_x[-2], orig_shape_x[-1]) new_shape_y = (num_outer_elts, orig_shape_y[-2], orig_shape_y[-1]) input_x = _op.reshape(input_x, newshape=new_shape_x)