GetResourceContext

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Header File/Library File

  • Header file: #include <graph/inference_context.h>
  • Library file: libgraph.so

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() {}};

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.