FilesLast commitLast update
13 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
13 days ago
README

PreventGradient

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products √
Atlas inference products √
Atlas training products √

Function Description

  • Operator function: during forward computation, returns the input tensor as is without any numerical transformation; during backpropagation (gradient computation), this operator does not provide a gradient. Once gradient computation needs to flow through this operator, the framework immediately reports an error and terminates. This operator is used to explicitly block gradient backpropagation.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor. ALL ND
y Output Tensor with the same shape, data type, and content as the input x. Same as x ND
message Attribute Prompt message output when an error is reported during backpropagation. The default value is an empty string. STRING -

Constraint Description

  • The shapes and data types of x and y are consistent.
  • This operator does not perform numerical transformation during forward computation; message is output only as a prompt message when an error is reported during backpropagation.

Invocation Description

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_prevent_gradient Invokes the PreventGradient operator by building a graph through the operator IR.