Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit c763448

Browse files
committed
Fix bug in Tape example
1 parent e30dbf1 commit c763448

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rfcs/20201201-cpp-gradients.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ Status ExpGradModel(AbstractContext* ctx,
234234
std::vector<AbstractTensorHandle*> exp_outputs(1);
235235
TF_RETURN_IF_ERROR(ops::Exp(ctx, inputs, absl::MakeSpan(exp_outputs), "Exp"));
236236
std::unique_ptr<GradientFunction> gradient_function;
237-
TF_RETURN_IF_ERROR(registry.Lookup("Exp", &gradient_function));
237+
ForwardOperation forward_op;
238+
forward_op.op_name = “Exp”;
239+
forward_op.inputs.push_back(inputs[0]);
240+
forward_op.outputs.push_back(outputs[0]);
241+
TF_RETURN_IF_ERROR(registry.Lookup(forward_op, &gradient_function));
238242
tape.RecordOperation(inputs, exp_outputs, gradient_function.release());
239243
TF_RETURN_IF_ERROR(tape.ComputeGradient(ctx,
240244
/*targets*/exp_outputs,

0 commit comments

Comments
 (0)