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

Method shape

python/paddle/base/framework.py:2445–2466  ·  view source on GitHub ↗

Indicating shape of current Variable **Notes: This is a read-only property** Examples: .. code-block:: pycon >>> import paddle.base as base >>> cur_program = base.Program() >>> cur_block = cur_program.current_blo

(self)

Source from the content-addressed store, hash-verified

2443
2444 @property
2445 def shape(self):
2446 """
2447 Indicating shape of current Variable
2448
2449 **Notes: This is a read-only property**
2450
2451 Examples:
2452 .. code-block:: pycon
2453
2454 >>> import paddle.base as base
2455 >>> cur_program = base.Program()
2456 >>> cur_block = cur_program.current_block()
2457 >>> new_variable = cur_block.create_var(
2458 ... name="X",
2459 ... shape=[-1, 23, 48],
2460 ... dtype="float32",
2461 ... )
2462 >>> print("shape of current Var is: {}".format(new_variable.shape))
2463 shape of current Var is: [-1, 23, 48]
2464 """
2465 # convert to tuple, make it as same as numpy API.
2466 return tuple(self.desc.shape())
2467
2468 @property
2469 def dtype(self):

Callers 15

fftshiftFunction · 0.45
ifftshiftFunction · 0.45
reshape_lhs_rhsFunction · 0.45
set_valueFunction · 0.45
_insert_dequant_opMethod · 0.45
_insert_funcMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected