Fix convert_variables_to_constants_v2 for scalar valued captures

tensor.numpy() can return a scalar, not a numpy array.
This commit is contained in:
TomWildenhain-Microsoft 2020-12-11 14:11:01 -05:00 committed by GitHub
parent 37c9633c50
commit 50defe7de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,