GetResourceContext

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Header File

#include <graph/inference_context.h>

Function Usage

Obtains a resource context object based on a resource key.

Prototype

1
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.

Constraints

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.