目录

SetResourceContext

Function Description

Sets the resource context object for the resource identified by the key and hands it over to the resource context manager for management.

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

Function 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 a resource context object. For details, see the return value of GetResourceContext.

Return Value

graphStatus: GRAPH_SUCCESS for success; GRAPH_FAILED for failure.

Restrictions

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