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

Method block

python/paddle/base/framework.py:7241–7266  ·  view source on GitHub ↗

.. note:: This API has no effect in Dygraph mode. Get the :code:`index` :ref:`api_guide_Block_en` of this Program Args: index (int): The index of :ref:`api_guide_Block_en` to get Returns: :ref:`api_guide_Block_en`: The :code

(self, index)

Source from the content-addressed store, hash-verified

7239 return self.blocks[0]
7240
7241 def block(self, index):
7242 """
7243 .. note::
7244 This API has no effect in Dygraph mode.
7245
7246 Get the :code:`index` :ref:`api_guide_Block_en` of this Program
7247
7248 Args:
7249 index (int): The index of :ref:`api_guide_Block_en` to get
7250
7251 Returns:
7252 :ref:`api_guide_Block_en`: The :code:`index` block
7253
7254 Examples:
7255 .. code-block:: pycon
7256
7257 >>> import paddle
7258 >>> import paddle.static as static
7259
7260 >>> paddle.enable_static()
7261
7262 >>> prog = static.default_main_program()
7263 >>> block_0 = prog.block(0)
7264 >>> print(block_0)
7265 """
7266 return self.blocks[index]
7267
7268 def current_block(self):
7269 """

Callers 15

_create_blockMethod · 0.95
add_build_strategy_forFunction · 0.95
check_weight_decayMethod · 0.95
_update_grad_persistableFunction · 0.45
new_local_tensorMethod · 0.45
_split_programMethod · 0.45
_add_op_device_attrMethod · 0.45
_check_validationMethod · 0.45

Calls

no outgoing calls

Tested by 3

check_weight_decayMethod · 0.76