Browse Source

Tensor.Creation: changed deallocatiors to readonly private

tags/v0.12
Eli Belash 6 years ago
parent
commit
a53d6ccda6
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs

+ 4
- 4
src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs View File

@@ -52,9 +52,9 @@ namespace Tensorflow
private DeallocatorArgs _deallocatorArgs = new DeallocatorArgs() { gc_handle = IntPtr.Zero };

// note: they must be assigned to a static variable in order to work as unmanaged callbacks
static Deallocator _hGlobalDeallocator = FreeHGlobalMemory;
static Deallocator _gcHandleDeallocator = FreeGCHandle;
private static Deallocator _nothingDeallocator = FreeNothing;
private static readonly Deallocator _hGlobalDeallocator = FreeHGlobalMemory;
private static readonly Deallocator _gcHandleDeallocator = FreeGCHandle;
private static readonly Deallocator _nothingDeallocator = FreeNothing;

/// <summary>
/// Create a Tensor object from an existing TF handle
@@ -624,7 +624,7 @@ namespace Tensorflow
Marshal.WriteInt64(tensor, 0);

var status = new Status();
fixed (byte* src = &buffer[0])
fixed (byte* src = buffer)
c_api.TF_StringEncode(src, (UIntPtr)buffer.Length, (sbyte*)(tensor + sizeof(Int64)), size, status);

status.Check(true);


Loading…
Cancel
Save