diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index 60f9247f00fa4ccb22588a985302dde5d0eefc1e..8f1b963ac8a5f7ee375578207840e9ed2e1907f4 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -336,11 +336,6 @@ list(REMOVE_ITEM TEST_OPS test_conv3d_transpose_op) list(REMOVE_ITEM TEST_OPS test_imperative_data_loader_exception) list(REMOVE_ITEM TEST_OPS test_sampling_id_op) list(REMOVE_ITEM TEST_OPS test_parallel_executor_fetch_isolated_var) -if (APPLE) - list(REMOVE_ITEM TEST_OPS test_imperative_framework) - list(REMOVE_ITEM TEST_OPS test_learning_rate_scheduler) - list(REMOVE_ITEM TEST_OPS test_var_base) -endif() if (APPLE OR WIN32) list(REMOVE_ITEM TEST_OPS test_dataset) @@ -606,4 +601,3 @@ if(NOT WIN32 AND NOT APPLE) set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 150) set_tests_properties(test_regularizer PROPERTIES TIMEOUT 150) endif() - diff --git a/python/paddle/tensor/to_string.py b/python/paddle/tensor/to_string.py index 940ad9204873d1972d8ed32ca0e2240b9c321171..0da110146a8e09ff3d1e7ffef85fabdbc60f0526 100644 --- a/python/paddle/tensor/to_string.py +++ b/python/paddle/tensor/to_string.py @@ -136,7 +136,7 @@ def _format_item(np_var, max_width=0): def _get_max_width(var): max_width = 0 - for item in np.nditer(var.numpy()): + for item in list(var.numpy().flatten()): item_str = _format_item(item) max_width = max(max_width, len(item_str)) return max_width @@ -147,7 +147,9 @@ def _format_tensor(var, sumary, indent=0): max_width = _get_max_width(_to_sumary(var)) if len(var.shape) == 0: - return _format_item(var.numpy.items(0), max_width) + # currently, shape = [], i.e., scaler tensor is not supported. + # If it is supported, it should be formatted like this. + return _format_item(var.numpy().item(0), max_width) elif len(var.shape) == 1: if sumary and var.shape[0] > 2 * edgeitems: items = [