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

Method num_blocks

python/paddle/base/framework.py:7178–7202  ·  view source on GitHub ↗

The number of :ref:`api_guide_Block_en` in this Program. .. note:: This API has no effect in Dygraph mode. Returns: int(Platform-dependent size): num of :ref:`api_guide_Block_en` in current Program Examples: .. code-block:: p

(self)

Source from the content-addressed store, hash-verified

7176
7177 @property
7178 def num_blocks(self):
7179 """
7180 The number of :ref:`api_guide_Block_en` in this Program.
7181
7182 .. note::
7183 This API has no effect in Dygraph mode.
7184
7185 Returns:
7186 int(Platform-dependent size): num of :ref:`api_guide_Block_en` in current Program
7187
7188
7189 Examples:
7190 .. code-block:: pycon
7191
7192 >>> import paddle
7193 >>> import paddle.static as static
7194
7195 >>> paddle.enable_static()
7196
7197 >>> prog = static.default_main_program()
7198 >>> num_blocks = prog.num_blocks
7199 >>> print(num_blocks)
7200 1
7201 """
7202 return self.desc.num_blocks()
7203
7204 @random_seed.setter
7205 def random_seed(self, seed):

Callers 15

get_model_opsFunction · 0.80
_rebuild_from_descMethod · 0.80
cloneMethod · 0.80
_prune_with_inputMethod · 0.80
_inference_optimizeMethod · 0.80
_remove_training_infoMethod · 0.80
parse_from_stringMethod · 0.80
_construct_from_descMethod · 0.80
_sync_with_cppMethod · 0.80
_copy_data_info_fromMethod · 0.80
_is_parameterFunction · 0.80

Calls

no outgoing calls

Tested by 2

_apply_ir_passesMethod · 0.64
test_append_blockMethod · 0.64