diff --git a/src/TensorFlowNET.Core/Graphs/Graph.cs b/src/TensorFlowNET.Core/Graphs/Graph.cs
index 9ca97d09..4de12257 100644
--- a/src/TensorFlowNET.Core/Graphs/Graph.cs
+++ b/src/TensorFlowNET.Core/Graphs/Graph.cs
@@ -105,6 +105,9 @@ namespace Tensorflow
public bool building_function;
+ string _container = "";
+ public string Container => _container;
+
int _seed;
public int seed
{
@@ -151,6 +154,8 @@ namespace Tensorflow
{
if (obj is RefVariable var)
return var._as_graph_element();
+ else if (obj is ResourceVariable resVar)
+ return resVar.GraphElement;
return null;
}
diff --git a/src/TensorFlowNET.Core/Graphs/c_api.graph.cs b/src/TensorFlowNET.Core/Graphs/c_api.graph.cs
index d2e450a8..429c448d 100644
--- a/src/TensorFlowNET.Core/Graphs/c_api.graph.cs
+++ b/src/TensorFlowNET.Core/Graphs/c_api.graph.cs
@@ -297,6 +297,21 @@ namespace Tensorflow
[DllImport(TensorFlowLibName)]
public static extern SafeImportGraphDefOptionsHandle TF_NewImportGraphDefOptions();
+ ///
+ /// Set the shapes and types of the output's handle.
+ ///
+ /// TF_Graph*
+ /// TF_Output
+ /// int
+ /// const int64_t**
+ /// const int*
+ /// const TF_DataType*
+ /// TF_Status*
+ [DllImport(TensorFlowLibName)]
+ public static extern void TF_GraphSetOutputHandleShapesAndTypes(IntPtr graph, TF_Output output,
+ int num_shapes_and_types, IntPtr[] shapes, int[] ranks, DataType[] types,
+ SafeStatusHandle status);
+
///
/// Updates 'dst' to consume 'new_src'.
///
diff --git a/test/TensorFlowNET.UnitTest/MultithreadingTests.cs b/test/TensorFlowNET.UnitTest/MultithreadingTests.cs
index edf30177..0bd37529 100644
--- a/test/TensorFlowNET.UnitTest/MultithreadingTests.cs
+++ b/test/TensorFlowNET.UnitTest/MultithreadingTests.cs
@@ -145,10 +145,9 @@ namespace TensorFlowNET.UnitTest
//tf.Session created an other graph
using (var sess = tf.Session())
{
- Tensor t = null;
for (int i = 0; i < 100; i++)
{
- t = new Tensor(new int[] {1, 2, 3});
+ var t = new Tensor(new int[] {1, 2, 3});
}
}
}
@@ -167,12 +166,9 @@ namespace TensorFlowNET.UnitTest
{
using (var sess = tf.Session())
{
-#pragma warning disable CS0219 // Variable is assigned but its value is never used
- Tensor t = null;
-#pragma warning restore CS0219 // Variable is assigned but its value is never used
for (int i = 0; i < 100; i++)
{
- var v = (int*) Marshal.AllocHGlobal(sizeof(int));
+ var v = (int*)Marshal.AllocHGlobal(sizeof(int));
c_api.DeallocatorArgs _deallocatorArgs = new c_api.DeallocatorArgs();
var handle = c_api.TF_NewTensor(typeof(int).as_dtype(), dims: new long[0], num_dims: 0,
data: (IntPtr) v, len: (UIntPtr) sizeof(int),