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)
| 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): |
no outgoing calls
no test coverage detected