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

Function global_scope

python/paddle/base/executor.py:76–95  ·  view source on GitHub ↗

:api_attr: Static Graph Get the global/default scope instance. There are a lot of APIs use :code:`global_scope` as its default value, e.g., :code:`Executor.run` Returns: Scope: The global/default scope instance. Examples: .. code-block:: pycon >>>

()

Source from the content-addressed store, hash-verified

74
75
76def global_scope() -> core._Scope:
77 """
78 :api_attr: Static Graph
79
80 Get the global/default scope instance. There are a lot of APIs use
81 :code:`global_scope` as its default value, e.g., :code:`Executor.run`
82
83 Returns:
84 Scope: The global/default scope instance.
85
86 Examples:
87 .. code-block:: pycon
88
89 >>> import paddle
90 >>> import numpy
91
92 >>> paddle.static.global_scope().var("data").get_tensor().set(numpy.ones((2, 2)), paddle.CPUPlace())
93 >>> numpy.array(paddle.static.global_scope().find_var("data").get_tensor())
94 """
95 return g_scope
96
97
98def _switch_scope(scope: core._Scope) -> core._Scope:

Callers 15

set_valueFunction · 0.90
get_valueFunction · 0.90
_serialize_persistablesFunction · 0.90
save_varsFunction · 0.90
get_tensorFunction · 0.90
set_varFunction · 0.90
loadFunction · 0.90
set_varFunction · 0.90
save_vars_pirFunction · 0.90
load_vars_pirFunction · 0.90
get_tensorFunction · 0.90
load_pirFunction · 0.90

Calls

no outgoing calls

Tested by 5

build_programMethod · 0.72
build_programMethod · 0.72
build_programMethod · 0.72
trainMethod · 0.72
build_programMethod · 0.72