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

Function numpy

python/paddle/pir/math_op_patch.py:1394–1417  ·  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 as

(self, *, force=True)

Source from the content-addressed store, hash-verified

1392
1393 @fake_interface_only
1394 def numpy(self, *, force=True):
1395 """
1396 **Notes**:
1397 **This API is ONLY available in Dygraph mode**
1398 Returns a numpy array shows the value of current :ref:`api_guide_Variable_en`
1399 Returns:
1400 ndarray: The numpy value of current Variable.
1401 Returns type:
1402 ndarray: dtype is same as current Variable
1403 Examples:
1404 .. code-block:: pycon
1405
1406 >>> import paddle
1407 >>> import paddle.base as base
1408 >>> from paddle.nn import Linear
1409 >>> import numpy as np
1410 >>> data = np.random.uniform(-1, 1, [30, 10, 32]).astype('float32')
1411 >>> with base.dygraph.guard():
1412 ... linear = Linear(32, 64)
1413 ... data_tensor = paddle.to_tensor(data)
1414 ... x = linear(data_tensor)
1415 ... print(x.numpy())
1416 """
1417 pass
1418
1419 @fake_interface_only
1420 def tolist(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected