|
2 | 2 |
|
3 | 3 | using Tensorflow.Eager; |
4 | 4 | using Tensorflow.Contexts; |
| 5 | +using Tensorflow.Exceptions; |
5 | 6 | using static Tensorflow.Binding; |
6 | 7 |
|
7 | 8 | namespace Tensorflow; |
@@ -54,6 +55,10 @@ public static Tensor[] _case(Tensor branch_index, Tensors input, TF_DataType[] T |
54 | 55 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "Case", name) { args = new object[] { branch_index, input }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["branches"] = branches, ["output_shapes"] = output_shapes } }); |
55 | 56 | return _fast_path_result; |
56 | 57 | } |
| 58 | + catch (NotOkStatusException ex) |
| 59 | + { |
| 60 | + throw ex; |
| 61 | + } |
57 | 62 | catch (Exception) |
58 | 63 | { |
59 | 64 | } |
@@ -115,6 +120,10 @@ public static Tensor device_index(string[] device_names, string? name = null) |
115 | 120 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "DeviceIndex", name) { args = new object[] { }, attrs = new Dictionary<string, object>() { ["device_names"] = device_names } }); |
116 | 121 | return _fast_path_result[0]; |
117 | 122 | } |
| 123 | + catch (NotOkStatusException ex) |
| 124 | + { |
| 125 | + throw ex; |
| 126 | + } |
118 | 127 | catch (Exception) |
119 | 128 | { |
120 | 129 | } |
@@ -172,6 +181,10 @@ public static Tensor fake_param(TF_DataType dtype, Shape shape, string? name = n |
172 | 181 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "FakeParam", name) { args = new object[] { }, attrs = new Dictionary<string, object>() { ["dtype"] = dtype, ["shape"] = shape } }); |
173 | 182 | return _fast_path_result[0]; |
174 | 183 | } |
| 184 | + catch (NotOkStatusException ex) |
| 185 | + { |
| 186 | + throw ex; |
| 187 | + } |
175 | 188 | catch (Exception) |
176 | 189 | { |
177 | 190 | } |
@@ -240,6 +253,10 @@ public static Tensor[] _for(Tensor start, Tensor limit, Tensor delta, Tensors in |
240 | 253 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "For", name) { args = new object[] { start, limit, delta, input }, attrs = new Dictionary<string, object>() { ["body"] = body } }); |
241 | 254 | return _fast_path_result; |
242 | 255 | } |
| 256 | + catch (NotOkStatusException ex) |
| 257 | + { |
| 258 | + throw ex; |
| 259 | + } |
243 | 260 | catch (Exception) |
244 | 261 | { |
245 | 262 | } |
@@ -310,6 +327,10 @@ public static Tensor[] _if(Tensor cond, Tensors input, TF_DataType[] Tout, objec |
310 | 327 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "If", name) { args = new object[] { cond, input }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["then_branch"] = then_branch, ["else_branch"] = else_branch, ["output_shapes"] = output_shapes } }); |
311 | 328 | return _fast_path_result; |
312 | 329 | } |
| 330 | + catch (NotOkStatusException ex) |
| 331 | + { |
| 332 | + throw ex; |
| 333 | + } |
313 | 334 | catch (Exception) |
314 | 335 | { |
315 | 336 | } |
@@ -385,6 +406,10 @@ public static Tensor[] partitioned_call(Tensors args, TF_DataType[] Tout, object |
385 | 406 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "PartitionedCall", name) { args = new object[] { args }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["f"] = f, ["config"] = config, ["config_proto"] = config_proto, ["executor_type"] = executor_type } }); |
386 | 407 | return _fast_path_result; |
387 | 408 | } |
| 409 | + catch (NotOkStatusException ex) |
| 410 | + { |
| 411 | + throw ex; |
| 412 | + } |
388 | 413 | catch (Exception) |
389 | 414 | { |
390 | 415 | } |
@@ -462,6 +487,10 @@ public static Tensor[] remote_call(Tensor target, Tensors args, TF_DataType[] To |
462 | 487 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "RemoteCall", name) { args = new object[] { target, args }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["f"] = f } }); |
463 | 488 | return _fast_path_result; |
464 | 489 | } |
| 490 | + catch (NotOkStatusException ex) |
| 491 | + { |
| 492 | + throw ex; |
| 493 | + } |
465 | 494 | catch (Exception) |
466 | 495 | { |
467 | 496 | } |
@@ -529,6 +558,10 @@ public static Tensor[] stateful_partitioned_call(Tensors args, TF_DataType[] Tou |
529 | 558 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "StatefulPartitionedCall", name) { args = new object[] { args }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["f"] = f, ["config"] = config, ["config_proto"] = config_proto, ["executor_type"] = executor_type } }); |
530 | 559 | return _fast_path_result; |
531 | 560 | } |
| 561 | + catch (NotOkStatusException ex) |
| 562 | + { |
| 563 | + throw ex; |
| 564 | + } |
532 | 565 | catch (Exception) |
533 | 566 | { |
534 | 567 | } |
@@ -628,6 +661,10 @@ public static Tensor[] stateless_case(Tensor branch_index, Tensors input, TF_Dat |
628 | 661 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "StatelessCase", name) { args = new object[] { branch_index, input }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["branches"] = branches, ["output_shapes"] = output_shapes } }); |
629 | 662 | return _fast_path_result; |
630 | 663 | } |
| 664 | + catch (NotOkStatusException ex) |
| 665 | + { |
| 666 | + throw ex; |
| 667 | + } |
631 | 668 | catch (Exception) |
632 | 669 | { |
633 | 670 | } |
@@ -698,6 +735,10 @@ public static Tensor[] stateless_if(Tensor cond, Tensors input, TF_DataType[] To |
698 | 735 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "StatelessIf", name) { args = new object[] { cond, input }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["then_branch"] = then_branch, ["else_branch"] = else_branch, ["output_shapes"] = output_shapes } }); |
699 | 736 | return _fast_path_result; |
700 | 737 | } |
| 738 | + catch (NotOkStatusException ex) |
| 739 | + { |
| 740 | + throw ex; |
| 741 | + } |
701 | 742 | catch (Exception) |
702 | 743 | { |
703 | 744 | } |
@@ -775,6 +816,10 @@ public static Tensor[] stateless_while(Tensors input, object cond, object body, |
775 | 816 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "StatelessWhile", name) { args = new object[] { input }, attrs = new Dictionary<string, object>() { ["cond"] = cond, ["body"] = body, ["output_shapes"] = output_shapes, ["parallel_iterations"] = parallel_iterations } }); |
776 | 817 | return _fast_path_result; |
777 | 818 | } |
| 819 | + catch (NotOkStatusException ex) |
| 820 | + { |
| 821 | + throw ex; |
| 822 | + } |
778 | 823 | catch (Exception) |
779 | 824 | { |
780 | 825 | } |
@@ -855,6 +900,10 @@ public static Tensor[] symbolic_gradient(Tensors input, TF_DataType[] Tout, obje |
855 | 900 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "SymbolicGradient", name) { args = new object[] { input }, attrs = new Dictionary<string, object>() { ["Tout"] = Tout, ["f"] = f } }); |
856 | 901 | return _fast_path_result; |
857 | 902 | } |
| 903 | + catch (NotOkStatusException ex) |
| 904 | + { |
| 905 | + throw ex; |
| 906 | + } |
858 | 907 | catch (Exception) |
859 | 908 | { |
860 | 909 | } |
@@ -922,6 +971,10 @@ public static Tensor to_bool(Tensor input, string? name = null) |
922 | 971 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "ToBool", name) { args = new object[] { input }, attrs = new Dictionary<string, object>() { } }); |
923 | 972 | return _fast_path_result[0]; |
924 | 973 | } |
| 974 | + catch (NotOkStatusException ex) |
| 975 | + { |
| 976 | + throw ex; |
| 977 | + } |
925 | 978 | catch (Exception) |
926 | 979 | { |
927 | 980 | } |
@@ -991,6 +1044,10 @@ public static Tensor[] _while(Tensors input, object cond, object body, Shape[] o |
991 | 1044 | var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "While", name) { args = new object[] { input }, attrs = new Dictionary<string, object>() { ["cond"] = cond, ["body"] = body, ["output_shapes"] = output_shapes, ["parallel_iterations"] = parallel_iterations } }); |
992 | 1045 | return _fast_path_result; |
993 | 1046 | } |
| 1047 | + catch (NotOkStatusException ex) |
| 1048 | + { |
| 1049 | + throw ex; |
| 1050 | + } |
994 | 1051 | catch (Exception) |
995 | 1052 | { |
996 | 1053 | } |
|
0 commit comments