From 50defe7de35fdac9d611ae4c3a4eb71ae12280ef Mon Sep 17 00:00:00 2001 From: TomWildenhain-Microsoft <67606533+TomWildenhain-Microsoft@users.noreply.github.com> Date: Fri, 11 Dec 2020 14:11:01 -0500 Subject: [PATCH] Fix convert_variables_to_constants_v2 for scalar valued captures tensor.numpy() can return a scalar, not a numpy array. --- tensorflow/python/framework/convert_to_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/python/framework/convert_to_constants.py b/tensorflow/python/framework/convert_to_constants.py index 19ab368592c..0fd77dc1dfc 100644 --- a/tensorflow/python/framework/convert_to_constants.py +++ b/tensorflow/python/framework/convert_to_constants.py @@ -823,7 +823,7 @@ class _FunctionConverterData(_ConverterData): if idx in map_index_to_variable: data = map_index_to_variable[idx].numpy() else: - data = val_tensor.numpy() + data = np.array(val_tensor.numpy()) self._tensor_data[tensor_name] = _TensorData( numpy=data, dtype=dtypes.as_dtype(data.dtype).as_datatype_enum,