diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs index 68d07312..61cfbef3 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs @@ -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; /// /// 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);