MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CumsumGrad

Function CumsumGrad

tensorflow/cc/gradients/math_grad.cc:1138–1160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1136REGISTER_GRADIENT_OP("BatchMatMul", BatchMatMulGrad);
1137
1138Status CumsumGrad(const Scope& scope, const Operation& op,
1139 const std::vector<Output>& grad_inputs,
1140 std::vector<Output>* grad_outputs) {
1141 if (op.num_inputs() != 2) {
1142 return errors::InvalidArgument("Cumsum requires 2 arguments");
1143 }
1144 if (grad_inputs.size() != 1) {
1145 return errors::InvalidArgument("Cumsum grad requires 1 grad input");
1146 }
1147
1148 Cumsum::Attrs attrs;
1149 TF_RETURN_IF_ERROR(
1150 GetNodeAttr(op.node()->attrs(), "exclusive", &attrs.exclusive_));
1151 bool reverse;
1152 TF_RETURN_IF_ERROR(GetNodeAttr(op.node()->attrs(), "reverse", &reverse));
1153 attrs.reverse_ = !reverse;
1154
1155 auto axis = op.input(1);
1156 auto sum = Cumsum(scope, grad_inputs[0], axis, attrs);
1157 grad_outputs->push_back(sum.out);
1158 grad_outputs->push_back(NoGradient());
1159 return scope.status();
1160}
1161REGISTER_GRADIENT_OP("Cumsum", CumsumGrad);
1162
1163bool IsFloatingPointDtype(DataType dtype) {

Callers

nothing calls this directly

Calls 11

InvalidArgumentFunction · 0.85
NoGradientFunction · 0.85
GetNodeAttrFunction · 0.50
CumsumFunction · 0.50
num_inputsMethod · 0.45
sizeMethod · 0.45
attrsMethod · 0.45
nodeMethod · 0.45
inputMethod · 0.45
push_backMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected