MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / numpy

Method numpy

python/paddle/base/framework.py:1943–1972  ·  view source on GitHub ↗

**Notes**: **This API is ONLY available in Dygraph mode** Returns a numpy array shows the value of current :ref:`api_guide_Variable_en` Returns: ndarray: The numpy value of current Variable. Returns type: ndarray: dtype is same

(self, *, force=True)

Source from the content-addressed store, hash-verified

1941
1942 @fake_interface_only
1943 def numpy(self, *, force=True):
1944 """
1945 **Notes**:
1946 **This API is ONLY available in Dygraph mode**
1947
1948 Returns a numpy array shows the value of current :ref:`api_guide_Variable_en`
1949
1950 Returns:
1951 ndarray: The numpy value of current Variable.
1952
1953 Returns type:
1954 ndarray: dtype is same as current Variable
1955
1956 Examples:
1957 .. code-block:: pycon
1958
1959 >>> import paddle
1960 >>> import paddle.base as base
1961 >>> from paddle.nn import Linear
1962 >>> import numpy as np
1963
1964 >>> data = np.random.uniform(-1, 1, [30, 10, 32]).astype('float32')
1965 >>> with base.dygraph.guard():
1966 ... linear = Linear(32, 64)
1967 ... data_tensor = paddle.to_tensor(data)
1968 ... x = linear(data_tensor)
1969 ... print(x.numpy())
1970
1971 """
1972 pass
1973
1974 @non_static_only
1975 def backward(self, retain_graph=False):

Callers 15

_infer_dense_shapeFunction · 0.80
_infer_dense_csr_shapeFunction · 0.80
_convert_to_floatFunction · 0.80
to_stringFunction · 0.80
_format_dense_tensorFunction · 0.80
sliceFunction · 0.80
tolistFunction · 0.80
_to_tensor_non_staticFunction · 0.80
combine_abs_max_and_histFunction · 0.80
sample_dataMethod · 0.80
dynamic_flopsFunction · 0.80

Calls

no outgoing calls