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

Function PackGrad

tensorflow/cc/gradients/array_grad.cc:42–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40REGISTER_NO_GRADIENT_OP("OneHot");
41
42Status PackGrad(const Scope& scope, const Operation& op,
43 const std::vector<Output>& grad_inputs,
44 std::vector<Output>* grad_outputs) {
45 int N;
46 TF_RETURN_IF_ERROR(GetNodeAttr(op.node()->attrs(), "N", &N));
47 int axis;
48 TF_RETURN_IF_ERROR(GetNodeAttr(op.node()->attrs(), "axis", &axis));
49
50 grad_outputs->reserve(N);
51 auto grad_op = Unstack(scope, grad_inputs[0], N, Unstack::Axis(axis));
52 for (const Output& o : grad_op.output) {
53 grad_outputs->emplace_back(o);
54 }
55 return scope.status();
56}
57REGISTER_GRADIENT_OP("Pack", PackGrad);
58
59Status UnpackGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 7

GetNodeAttrFunction · 0.50
AxisClass · 0.50
attrsMethod · 0.45
nodeMethod · 0.45
reserveMethod · 0.45
emplace_backMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected