MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / SetScopeProtoStr

Function SetScopeProtoStr

python/oneflow/framework/scope_util.py:31–42  ·  view source on GitHub ↗
(serialized_scope_proto: str)

Source from the content-addressed store, hash-verified

29 name2default = session_ctx.GetDefaultSession().scope_attr_name2default_val
30
31 def SetScopeProtoStr(serialized_scope_proto: str):
32 scope_proto = text_format.Parse(
33 serialized_scope_proto, scope_pb2_util.ScopeProto()
34 )
35 for (attr_name, py_value) in kwargs.items():
36 assert attr_name in name2default
37 attr_util.SetProtoAttrValue(
38 scope_proto.attr_name2attr_value[attr_name],
39 py_value,
40 name2default[attr_name],
41 )
42 return str(text_format.MessageToString(scope_proto))
43
44 sess = session_ctx.GetDefaultSession()
45 scope = MakeScope(

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected