Skip to content

Commit a8047ef

Browse files
committed
Drop the ref long[] signature in two methods, variation of the fix from @mwk88 at migueldeicaza#63
1 parent 9b411a1 commit a8047ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

TensorFlowSharp/Tensorflow.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ internal override void NativeDispose (IntPtr handle)
440440

441441
// extern void TF_GraphSetTensorShape (TF_Graph *graph, TF_Output output, const int64_t *dims, const int num_dims, TF_Status *status);
442442
[DllImport (NativeBinding.TensorFlowLibrary)]
443-
static extern unsafe void TF_GraphSetTensorShape (TF_Graph graph, TFOutput output, ref long [] dims, int num_dims, TF_Status status);
443+
static extern unsafe void TF_GraphSetTensorShape (TF_Graph graph, TFOutput output, long [] dims, int num_dims, TF_Status status);
444444
[DllImport (NativeBinding.TensorFlowLibrary)]
445445
static extern unsafe void TF_GraphSetTensorShape (TF_Graph graph, TFOutput output, IntPtr dims, int num_dims, TF_Status status);
446446

@@ -453,7 +453,7 @@ public void SetTensorShape (TFOutput output, long [] dims, TFStatus status = nul
453453
if (dims == null)
454454
TF_GraphSetTensorShape (handle, output, IntPtr.Zero, 0, cstatus.handle);
455455
else
456-
TF_GraphSetTensorShape (handle, output, ref dims, dims.Length, cstatus.handle);
456+
TF_GraphSetTensorShape (handle, output, dims, dims.Length, cstatus.handle);
457457
cstatus.CheckMaybeRaise (status);
458458
}
459459

@@ -473,7 +473,7 @@ public int GetTensorNumDims (TFOutput output, TFStatus status = null)
473473

474474
// extern void TF_GraphGetTensorShape (TF_Graph *graph, TF_Output output, int64_t *dims, int num_dims, TF_Status *status);
475475
[DllImport (NativeBinding.TensorFlowLibrary)]
476-
static extern unsafe void TF_GraphGetTensorShape (TF_Graph graph, TFOutput output, ref long [] dims, int num_dims, TF_Status status);
476+
static extern unsafe void TF_GraphGetTensorShape (TF_Graph graph, TFOutput output, long [] dims, int num_dims, TF_Status status);
477477

478478
public long [] GetTensorShape (TFOutput output, TFStatus status = null)
479479
{
@@ -485,7 +485,7 @@ public long [] GetTensorShape (TFOutput output, TFStatus status = null)
485485
return null;
486486

487487
var dims = new long [n];
488-
TF_GraphGetTensorShape (handle, output, ref dims, dims.Length, cstatus.handle);
488+
TF_GraphGetTensorShape (handle, output, dims, dims.Length, cstatus.handle);
489489
cstatus.CheckMaybeRaise (status);
490490
return dims;
491491
}
@@ -658,7 +658,7 @@ public long [] GetShape (TFOutput output, TFStatus status = null)
658658
if (ndims == 0)
659659
return null;
660660
var ret = new long [ndims];
661-
TF_GraphGetTensorShape (handle, output, ref ret, ndims, cstatus.handle);
661+
TF_GraphGetTensorShape (handle, output, ret, ndims, cstatus.handle);
662662
cstatus.CheckMaybeRaise (status);
663663
return ret;
664664
}

0 commit comments

Comments
 (0)