8000 feat: update some gen_ops. · SciSharp/TensorFlow.NET@0114885 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0114885

Browse files
committed
feat: update some gen_ops.
1 parent 6b30902 commit 0114885

File tree

7 files changed

+2450
-121
lines changed

7 files changed

+2450
-121
lines changed

src/TensorFlowNET.Core/Operations/gen_array_ops.cs

Lines changed: 489 additions & 10 deletions
Large diffs are not rendered by default.

src/TensorFlowNET.Core/Operations/gen_functional_ops.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using Tensorflow.Eager;
44
using Tensorflow.Contexts;
5+
using Tensorflow.Exceptions;
56
using static Tensorflow.Binding;
67

78
namespace Tensorflow;
@@ -54,6 +55,10 @@ public static Tensor[] _case(Tensor branch_index, Tensors input, TF_DataType[] T
5455
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 } });
5556
return _fast_path_result;
5657
}
58+
catch (NotOkStatusException ex)
59+
{
60+
throw ex;
61+
}
5762
catch (Exception)
5863
{
5964
}
@@ -115,6 +120,10 @@ public static Tensor device_index(string[] device_names, string? name = null)
115120
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 } });
116121
return _fast_path_result[0];
117122
}
123+
catch (NotOkStatusException ex)
124+
{
125+
throw ex;
126+
}
118127
catch (Exception)
119128
{
120129
}
@@ -172,6 +181,10 @@ public static Tensor fake_param(TF_DataType dtype, Shape shape, string? name = n
172181
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 } });
173182
return _fast_path_result[0];
174183
}
184+
catch (NotOkStatusException ex)
185+
{
186+
throw ex;
187+
}
175188
catch (Exception)
176189
{
177190
}
@@ -240,6 +253,10 @@ public static Tensor[] _for(Tensor start, Tensor limit, Tensor delta, Tensors in
240253
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 } });
241254
return _fast_path_result;
242255
}
256+
catch (NotOkStatusException ex)
257+
{
258+
throw ex;
259+
}
243260
catch (Exception)
244261
{
245262
}
@@ -310,6 +327,10 @@ public static Tensor[] _if(Tensor cond, Tensors input, TF_DataType[] Tout, objec
310327
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 } });
311328
return _fast_path_result;
312329
}
330+
catch (NotOkStatusException ex)
331+
{
332+
throw ex;
333+
}
313334
catch (Exception)
314335
{
315336
}
@@ -385,6 +406,10 @@ public static Tensor[] partitioned_call(Tensors args, TF_DataType[] Tout, object
385406
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 } });
386407
return _fast_path_result;
387408
}
409+
catch (NotOkStatusException ex)
410+
{
411+
throw ex;
412+
}
388413
catch (Exception)
389414
{
390415
}
@@ -462,6 +487,10 @@ public static Tensor[] remote_call(Tensor target, Tensors args, TF_DataType[] To
462487
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 } });
463488
return _fast_path_result;
464489
}
490+
catch (NotOkStatusException ex)
491+
{
492+
throw ex;
493+
}
465494
catch (Exception)
466495
{
467496
}
@@ -529,6 +558,10 @@ public static Tensor[] stateful_partitioned_call(Tensors args, TF_DataType[] Tou
529558
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 } });
530559
return _fast_path_result;
531560
}
561+
catch (NotOkStatusException ex)
562+
{
563+
throw ex;
564+
}
532565
catch (Exception)
533566
{
534567
}
@@ -628,6 +661,10 @@ public static Tensor[] stateless_case(Tensor branch_index, Tensors input, TF_Dat
628661
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 } });
629662
return _fast_path_result;
630663
}
664+
catch (NotOkStatusException ex)
665+
{
666+
throw ex;
667+
}
631668
catch (Exception)
632669
{
633670
}
@@ -698,6 +735,10 @@ public static Tensor[] stateless_if(Tensor cond, Tensors input, TF_DataType[] To
698735
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 } });
699736
return _fast_path_result;
700737
}
738+
catch (NotOkStatusException ex)
739+
{
740+
throw ex;
741+
}
701742
catch (Exception)
702743
{
703744
}
@@ -775,6 +816,10 @@ public static Tensor[] stateless_while(Tensors input, object cond, object body,
775816
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 } });
776817
return _fast_path_result;
777818
}
819+
catch (NotOkStatusException ex)
820+
{
821+
throw ex;
822+
}
778823
catch (Exception)
779824
{
780825
}
@@ -855,6 +900,10 @@ public static Tensor[] symbolic_gradient(Tensors input, TF_DataType[] Tout, obje
855900
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 } });
856901
return _fast_path_result;
857902
}
903+
catch (NotOkStatusException ex)
904+
{
905+
throw ex;
906+
}
858907
catch (Exception)
859908
{
860909
}
@@ -922,6 +971,10 @@ public static Tensor to_bool(Tensor input, string? name = null)
922971
var _fast_path_result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo(_ctx, "ToBool", name) { args = new object[] { input }, attrs = new Dictionary<string, object>() { } });
923972
return _fast_path_result[0];
924973
}
974+
catch (NotOkStatusException ex)
975+
{
976+
throw ex;
977+
}
925978
catch (Exception)
926979
{
927980
}
@@ -991,6 +1044,10 @@ public static Tensor[] _while(Tensors input, object cond, object body, Shape[] o
9911044
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 } });
9921045
return _fast_path_result;
9931046
}
1047+
catch (NotOkStatusException ex)
1048+
{
1049+
throw ex;
1050+
}
9941051
catch (Exception)
9951052
{
9961053
}

0 commit comments

Comments
 (0)
0