SetResourceContext

Description

Sets the resource context object for the resource that is marked with key. The resource context object is managed by the resource context manager.

This API is generally called by resource operators of the write type, such as stack push.

Prototype

graphStatus SetResourceContext(const ge::AscendString &key, ResourceContext *resource_context)

Parameters

Parameter

Input/Output

Description

key

Input

Unique resource key.

resource_context

Input

Pointer to the resource context object. For details, see Returns of the GetResourceContext API.

Returns

graphStatus type. GRAPH_SUCCESS on success; GRAPH_FAILED on failure.

Restrictions

This API call will return failure if the pointer to the resource context manager is not passed when InferenceContext is created using the Create API.