def as_numpy(tensor):
    '\n    Convert a Tensor to a numpy.ndarray, its only support Tensor without LoD information.\n    For higher dimensional sequence data, please use LoDTensor directly.\n\n    Examples:\n        .. code-block:: python\n\n          import paddle.fluid as fluid\n          import numpy\n\n          new_scope = fluid.Scope()\n          with fluid.scope_guard(new_scope):\n              fluid.global_scope().var("data").get_tensor().set(numpy.ones((2, 2)), fluid.CPUPlace())\n          tensor = new_scope.find_var("data").get_tensor()\n          fluid.executor.as_numpy(tensor) # or numpy.array(new_scope.find_var("data").get_tensor())\n\n    Args:\n       tensor(Variable): a instance of Tensor\n\n    Returns:\n        numpy.ndarray\n    '
    if isinstance(tensor, core.LoDTensorArray):
        return [as_numpy(t) for t in tensor]
    if isinstance(tensor, list):
        return [as_numpy(t) for t in tensor]
    assert isinstance(tensor, core.LoDTensor)
    lod = tensor.lod()
    if (len(lod) > 0):
        raise RuntimeError("Some of your fetched tensors hold LoD information.             They can not be completely cast to Python ndarray.             Please set the parameter 'return_numpy' as 'False' to             return LoDTensor itself directly.")
    if tensor._is_initialized():
        return np.array(tensor)
    else:
        return None
Convert a Tensor to a numpy.ndarray, its only support Tensor without LoD information.
For higher dimensional sequence data, please use LoDTensor directly.

Examples:
    .. code-block:: python

      import paddle.fluid as fluid
      import numpy

      new_scope = fluid.Scope()
      with fluid.scope_guard(new_scope):
          fluid.global_scope().var("data").get_tensor().set(numpy.ones((2, 2)), fluid.CPUPlace())
      tensor = new_scope.find_var("data").get_tensor()
      fluid.executor.as_numpy(tensor) # or numpy.array(new_scope.find_var("data").get_tensor())

Args:
   tensor(Variable): a instance of Tensor

Returns:
    numpy.ndarray
def as_numpy(tensor):
    '\n    Convert a Tensor to a numpy.ndarray, its only support Tensor without LoD information.\n    For higher dimensional sequence data, please use LoDTensor directly.\n\n    Examples:\n        .. code-block:: python\n\n          import paddle.fluid as fluid\n          import numpy\n\n          new_scope = fluid.Scope()\n          with fluid.scope_guard(new_scope):\n              fluid.global_scope().var("data").get_tensor().set(numpy.ones((2, 2)), fluid.CPUPlace())\n          tensor = new_scope.find_var("data").get_tensor()\n          fluid.executor.as_numpy(tensor) # or numpy.array(new_scope.find_var("data").get_tensor())\n\n    Args:\n       tensor(Variable): a instance of Tensor\n\n    Returns:\n        numpy.ndarray\n    '
    if isinstance(tensor, core.LoDTensorArray):
        return [as_numpy(t) for t in tensor]
    if isinstance(tensor, list):
        return [as_numpy(t) for t in tensor]
    assert isinstance(tensor, core.LoDTensor)
    lod = tensor.lod()
    if (len(lod) > 0):
        raise RuntimeError("Some of your fetched tensors hold LoD information.             They can not be completely cast to Python ndarray.             Please set the parameter 'return_numpy' as 'False' to             return LoDTensor itself directly.")
    if tensor._is_initialized():
        return np.array(tensor)
    else:
        return None