GetResourceContext

Description

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

Prototype

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

Parameters

Parameter

Input/Output

Description

key

Input

Unique resource key, which is specified by the InferShape function of the resource operator.

Returns

Resource context object.

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

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

Used to store resource information, such as shape and data type.

Restrictions

Check that the return is not a null pointer before using it, as this API will return a null pointer if the pointer to the resource context manager is not passed when creating InferenceContext using the Create API.