@@ -15,17 +15,22 @@ limitations under the License.
1515******************************************************************************/
1616
1717using System ;
18+ using static Tensorflow . Binding ;
1819
1920namespace Tensorflow
2021{
2122 public partial class tensorflow
2223 {
24+ public Tensor cond ( Tensor pred ,
25+ Tensor true_value ,
26+ Tensor false_false )
27+ => control_flow_ops . cond ( pred , ( ) => true_value , ( ) => false_false ) ;
28+
2329 public Tensor cond ( Tensor pred ,
2430 Func < ITensorOrOperation > true_fn = null ,
2531 Func < ITensorOrOperation > false_fn = null ,
26- bool strict = false ,
2732 string name = null )
28- => control_flow_ops . cond ( pred , true_fn , false_fn , strict : strict , name : name ) ;
33+ => control_flow_ops . cond ( pred , true_fn , false_fn , name : name ) ;
2934
3035 /// <summary>
3136 /// Create an op that groups multiple operations.
@@ -37,22 +42,31 @@ public Tensor cond(Tensor pred,
3742 public Operation group < T > ( T [ ] inputs , string name = null ) where T : ITensorOrOperation
3843 => control_flow_ops . group ( inputs , name : name ) ;
3944
40- /*public Tensor while_loop(Func<Tensor, Tensor> cond, Func<Tensor, Tensor> body, Tensor[] loop_vars,
41- TensorShape shape_invariants = null,
45+ public Tensor while_loop ( Func < Tensor , Tensor > cond ,
46+ Func < Tensor , Tensor > body ,
47+ Tensor loop_vars ,
48+ int parallel_iterations = 10 )
49+ {
50+ Func < Tensor [ ] , Tensor > cond1 = x
51+ => cond ( x [ 0 ] ) ;
52+
53+ Func < Tensor [ ] , Tensor [ ] > body1 = x
54+ => new [ ] { body ( x [ 0 ] ) } ;
55+
56+ var results = control_flow_ops . while_loop ( cond1 ,
57+ body1 ,
58+ new [ ] { loop_vars } ) ;
59+ return results [ 0 ] ;
60+ }
61+
62+ public Tensor [ ] while_loop ( Func < Tensor [ ] , Tensor > cond ,
63+ Func < Tensor [ ] , Tensor [ ] > body ,
64+ Tensor [ ] loop_vars ,
4265 int parallel_iterations = 10 ,
43- bool back_prop = true,
44- bool swap_memory = false,
45- string name = null,
46- int? maximum_iterations = null,
47- bool return_same_structure = false)
66+ string name = null )
4867 => control_flow_ops . while_loop ( cond , body , loop_vars ,
49- shape_invariants: shape_invariants,
5068 parallel_iterations : parallel_iterations ,
51- back_prop: back_prop,
52- swap_memory: swap_memory,
53- name: name,
54- maximum_iterations: maximum_iterations,
55- return_same_structure: return_same_structure);*/
69+ name : name ) ;
5670
5771 public _ControlDependenciesController control_dependencies ( ITensorOrOperation [ ] control_inputs )
5872 => ops . control_dependencies ( control_inputs ) ;
0 commit comments