UpdateOperationParam
Description
Updates Param of an Operation.
Definition
1 | Status UpdateOperationParam(Operation *operation, const OpParam &opParam); |
Parameters
Parameter |
Description |
|---|---|
operation |
Operation pointer. |
opParam |
New parameter value for an operation. |
Returns
Type |
Input/Output |
Description |
|---|---|---|
Status |
Output |
Status value. NO_ERROR is returned on success. |
Restrictions
EventOperation and the parameters in FillOperation, SortOperation, TopkToppSamplingOperation, and atb/train_op_params.h are supported.
Example
- Create an operation.
1 2 3 4 5
train::FastSoftMaxParam param; param.headNum = 3; param.qSeqLen = { 10, 20, 30 }; atb::Operation *op = nullptr; atb::Status st = atb::CreateOperation(param, &op);
- Obtain the parameters of the current operation.
1 2
train::FastSoftMaxParam cloneParam; st = atb::CloneOperationParam(op, cloneParam);
- Update the parameters of the current operation.
1 2
cloneParam.headNum = 66; st = atb::UpdateOperationParam(op, cloneParam);
Parent topic: atb/operation.h