目录

GetResourceContext

Function Description

Obtains the corresponding resource context object based on the resource key.

Function Prototype

ResourceContext *GetResourceContext(const ge::AscendString &key)

Parameters

Parameter Input/Output Description
key Input Unique resource ID. It is specified by the InferShape function of the resource operator.

Return Value

Type Description
ResourceContext *

Resource context object.

The basic definition is as follows, based on which the resource operator can be extended.

struct ResourceContext {virtual ~ResourceContext() {}};

It is used to store resource information, such as shape and data type.

Restrictions

This API will return a null pointer if the pointer to the resource context manager is not passed when InferenceContext is created using the Create API. You need to check whether the return is a null pointer before using it.