diff --git a/src/TensorFlowNET.Core/APIs/c_api.cs b/src/TensorFlowNET.Core/APIs/c_api.cs
index 7b7ade95..1595e128 100644
--- a/src/TensorFlowNET.Core/APIs/c_api.cs
+++ b/src/TensorFlowNET.Core/APIs/c_api.cs
@@ -53,7 +53,13 @@ namespace Tensorflow
return handle == IntPtr.Zero ? String.Empty : Marshal.PtrToStringAnsi(handle);
}
- public delegate void Deallocator(IntPtr data, IntPtr size, ref bool deallocator);
+ public delegate void Deallocator(IntPtr data, IntPtr size, ref DeallocatorArgs args);
+
+ public struct DeallocatorArgs
+ {
+ public bool deallocator_called;
+ public IntPtr gc_handle;
+ }
[DllImport(TensorFlowLibName)]
public static unsafe extern IntPtr TF_Version();
diff --git a/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs b/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs
index ea8f715a..b9735dfb 100644
--- a/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs
+++ b/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs
@@ -71,7 +71,7 @@ namespace Tensorflow
///
///
[DllImport(TensorFlowLibName)]
- public static extern IntPtr TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, UIntPtr len, Deallocator deallocator, ref bool deallocator_arg);
+ public static extern IntPtr TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, UIntPtr len, Deallocator deallocator, ref DeallocatorArgs deallocator_arg);
///
/// Return the number of dimensions that the tensor has.