@@ -11,7 +11,7 @@ public bool RecordGradient(string op_name,
1111 Tensor [ ] inputs ,
1212 object [ ] attrs ,
1313 Tensor [ ] results ,
14- Func < BackwardFunction > getBackwardFunction = null )
14+ BackwardFunction backwardFunction = null )
1515 {
1616 bool should_record = ShouldRecord ( inputs ) ;
1717
@@ -28,9 +28,9 @@ public bool RecordGradient(string op_name,
2828 }
2929
3030 if ( ! should_record ) return should_record ;
31- tf . Logger . Debug ( $ "RecordGradient: op_name={ op_name } ") ;
31+ // tf.Logger.Debug($"RecordGradient: op_name={op_name}");
3232
33- Tensor [ ] op_outputs ;
33+ /* Tensor[] op_outputs = null ;
3434 var unused_output_indices = gradient_exclustions.OpGradientUnusedOutputIndices(op_name);
3535 if (unused_output_indices != null)
3636 {
@@ -44,7 +44,7 @@ public bool RecordGradient(string op_name,
4444 else
4545 op_outputs = results;
4646
47- Tensor [ ] op_inputs ;
47+ Tensor[] op_inputs = null ;
4848 var unused_input_indices = gradient_exclustions.OpGradientUnusedInputIndices(op_name);
4949 if (unused_input_indices != null)
5050 {
@@ -56,22 +56,14 @@ public bool RecordGradient(string op_name,
5656 }
5757 }
5858 else
59- op_inputs = inputs ;
59+ op_inputs = inputs;*/
6060
61- TapeSetRecordOperation ( op_name , inputs , results ,
62- getBackwardFunction ?? GetBackwradFunction ( op_name , inputs , attrs , results ) ) ;
61+ backwardFunction = backwardFunction ?? GetGradientFunction ( op_name , inputs , attrs , results ) ;
62+ TapeSetRecordOperation ( op_name , inputs , results , backwardFunction ) ;
6363
6464 return true ;
6565 }
6666
67- Func < BackwardFunction > GetBackwradFunction ( string op_name ,
68- Tensor [ ] op_inputs ,
69- object [ ] attrs ,
70- Tensor [ ] op_outputs )
71- {
72- return ( ) => GetGradientFunction ( op_name , op_inputs , attrs , op_outputs ) ;
73- }
74-
7567 BackwardFunction GetGradientFunction ( string op_name ,
7668 Tensor [ ] op_inputs ,
7769 object [ ] attrs ,
0 commit comments