| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9bb603d commit 468cb8e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -105,6 +105,9 @@ public partial class Graph : DisposableObject | |||
| 105 | 105 | ||
| 106 | 106 | public bool building_function; | |
| 107 | 107 | ||
| 108 | + string _container = ""; | ||
| 109 | + public string Container => _container; | ||
| 110 | + | ||
| 108 | 111 | int _seed; | |
| 109 | 112 | public int seed | |
| 110 | 113 | { | |
@@ -151,6 +154,8 @@ private Tensor _as_graph_element(object obj) | |||
| 151 | 154 | { | |
| 152 | 155 | if (obj is RefVariable var) | |
| 153 | 156 | return var._as_graph_element(); | |
| 157 | + else if (obj is ResourceVariable resVar) | ||
| 158 | + return resVar.GraphElement; | ||
| 154 | 159 | ||
| 155 | 160 | return null; | |
| 156 | 161 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -297,6 +297,21 @@ public static extern IntPtr TF_LoadSessionFromSavedModel(SafeSessionOptionsHandl | |||
| 297 | 297 | [DllImport(TensorFlowLibName)] | |
| 298 | 298 | public static extern SafeImportGraphDefOptionsHandle TF_NewImportGraphDefOptions(); | |
| 299 | 299 | ||
| 300 | + /// <summary> | ||
| 301 | + /// Set the shapes and types of the output's handle. | ||
| 302 | + /// </summary> | ||
| 303 | + /// <param name="graph">TF_Graph*</param> | ||
| 304 | + /// <param name="output">TF_Output</param> | ||
| 305 | + /// <param name="num_shapes_and_types">int</param> | ||
| 306 | + /// <param name="shapes">const int64_t**</param> | ||
| 307 | + /// <param name="ranks">const int*</param> | ||
| 308 | + /// <param name="types">const TF_DataType*</param> | ||
| 309 | + /// <param name="status">TF_Status*</param> | ||
| 310 | + [DllImport(TensorFlowLibName)] | ||
| 311 | + public static extern void TF_GraphSetOutputHandleShapesAndTypes(IntPtr graph, TF_Output output, | ||
| 312 | + int num_shapes_and_types, IntPtr[] shapes, int[] ranks, DataType[] types, | ||
| 313 | + SafeStatusHandle status); | ||
| 314 | + | ||
| 300 | 315 | /// <summary> | |
| 301 | 316 | /// Updates 'dst' to consume 'new_src'. | |
| 302 | 317 | /// </summary> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,10 +145,9 @@ void Core(int tid) | |||
| 145 | 145 | //tf.Session created an other graph | |
| 146 | 146 | using (var sess = tf.Session()) | |
| 147 | 147 | { | |
| 148 | - Tensor t = null; | ||
| 149 | 148 | for (int i = 0; i < 100; i++) | |
| 150 | 149 | { | |
| 151 | - t = new Tensor(new int[] {1, 2, 3}); | ||
| 150 | + var t = new Tensor(new int[] {1, 2, 3}); | ||
| 152 | 151 | } | |
| 153 | 152 | } | |
| 154 | 153 | } | |
@@ -167,12 +166,9 @@ unsafe void Core(int tid) | |||
| 167 | 166 | { | |
| 168 | 167 | using (var sess = tf.Session()) | |
| 169 | 168 | { | |
| 170 | - #pragma warning disable CS0219 // Variable is assigned but its value is never used | ||
| 171 | - Tensor t = null; | ||
| 172 | - #pragma warning restore CS0219 // Variable is assigned but its value is never used | ||
| 173 | 169 | for (int i = 0; i < 100; i++) | |
| 174 | 170 | { | |
| 175 | - var v = (int*) Marshal.AllocHGlobal(sizeof(int)); | ||
| 171 | + var v = (int*)Marshal.AllocHGlobal(sizeof(int)); | ||
| 176 | 172 | c_api.DeallocatorArgs _deallocatorArgs = new c_api.DeallocatorArgs(); | |
| 177 | 173 | var handle = c_api.TF_NewTensor(typeof(int).as_dtype(), dims: new long[0], num_dims: 0, | |
| 178 | 174 | data: (IntPtr) v, len: (UIntPtr) sizeof(int), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments