Browse Source

Fix incorrect copy lengths in memcpy

tags/v0.20
Sam Harwell Esther Hu 5 years ago
parent
commit
076b3fc508
2 changed files with 1 additions and 5 deletions
  1. +1
    -1
      src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs
  2. +0
    -4
      src/TensorFlowNET.Core/tensorflow.memory.cs

+ 1
- 1
src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs View File

@@ -336,7 +336,7 @@ namespace Tensorflow.Eager
for (int i = 0; i < num_values; ++i)
{
dims[i] = Marshal.AllocHGlobal(sizeof(long) * values1[i].ndim);
tf.memcpy(dims[i], values1[i].dims.Select(x => (long)x).ToArray(), values1[i].ndim);
tf.memcpy(dims[i], values1[i].dims.Select(x => (long)x).ToArray(), values1[i].ndim * sizeof(long));
}

c_api.TFE_OpSetAttrShapeList(op, key, dims, num_dims, num_values, status.Handle);


+ 0
- 4
src/TensorFlowNET.Core/tensorflow.memory.cs View File

@@ -42,8 +42,6 @@ namespace Tensorflow
{
if (src.Length == 0) return;

size = size * (ulong)sizeof(T);

fixed (void* p = &src[0])
System.Buffer.MemoryCopy(p, dst.ToPointer(), size, size);
}
@@ -53,8 +51,6 @@ namespace Tensorflow
{
if (src.Length == 0) return;

size = size * sizeof(T);

fixed (void* p = &src[0])
System.Buffer.MemoryCopy(p, dst.ToPointer(), size, size);
}


Loading…
Cancel
Save