global_scope

paddle.static. global_scope ( ) [source]
Api_attr

Static Graph

Get the global/default scope instance. There are a lot of APIs use global_scope as its default value, e.g., Executor.run

Returns

The global/default scope instance.

Return type

Scope

Examples

>>> import paddle
>>> import numpy

>>> paddle.static.global_scope().var("data").get_tensor().set(numpy.ones((2, 2)), paddle.CPUPlace())
>>> numpy.array(paddle.static.global_scope().find_var("data").get_tensor())

Used in the guide/tutorials