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

Method current_block

python/paddle/base/framework.py:7268–7291  ·  view source on GitHub ↗

.. note:: This API has no effect in Dygraph mode. Get the current :ref:`api_guide_Block_en` . The :code:`current` :ref:`api_guide_Block_en` is the :ref:`api_guide_Block_en` to append operators. Returns: :ref:`api_guide_Block_en`: The :c

(self)

Source from the content-addressed store, hash-verified

7266 return self.blocks[index]
7267
7268 def current_block(self):
7269 """
7270 .. note::
7271 This API has no effect in Dygraph mode.
7272
7273 Get the current :ref:`api_guide_Block_en` . The :code:`current` :ref:`api_guide_Block_en`
7274 is the :ref:`api_guide_Block_en` to append operators.
7275
7276 Returns:
7277 :ref:`api_guide_Block_en`: The :code:`index` :ref:`api_guide_Block_en`
7278
7279 Examples:
7280 .. code-block:: pycon
7281
7282 >>> import paddle
7283 >>> import paddle.static as static
7284
7285 >>> paddle.enable_static()
7286
7287 >>> prog = static.default_main_program()
7288 >>> current_blk = prog.current_block()
7289 >>> print(current_blk)
7290 """
7291 return self.blocks[self.current_block_idx]
7292
7293 def _create_block(self, parent_idx=None):
7294 """

Callers 15

_func_to_program_descMethod · 0.95
_create_blockMethod · 0.95
_rollbackMethod · 0.95
test_op_desc_creationMethod · 0.95
test_mult_inputMethod · 0.95
test_debug_strMethod · 0.95
test_fetch_handlerMethod · 0.95
test_step_scopesMethod · 0.95
completeMethod · 0.80
_completeMethod · 0.80

Calls

no outgoing calls

Tested by 13

test_op_desc_creationMethod · 0.76
test_mult_inputMethod · 0.76
test_debug_strMethod · 0.76
test_fetch_handlerMethod · 0.76
test_step_scopesMethod · 0.76
test_varMethod · 0.64
_tostringMethod · 0.64
test_detachMethod · 0.64