19 auto runningSize = size;
22 for (
unsigned int i=0; i < lastIdx ; i++)
24 strides[lastIdx-i] = runningSize;
25 runningSize *= shape[lastIdx-i];
27 strides[0] = runningSize;
32 : m_TensorInfo(tensorInfo)
38 const void* ConstTensorHandle::GetConstTensor<void>()
const
45 , m_MutableMemory(nullptr)
50 void* TensorHandle::GetTensor<void>()
const
52 return m_MutableMemory;
80 ::operator
delete(GetTensor<void>());
88 ::operator
delete(GetTensor<void>());
93 if (GetTensor<void>() ==
nullptr)
100 "that already has allocated memory.");
104 void ScopedTensorHandle::CopyOutTo(
void* memory)
const
106 memcpy(memory, GetTensor<void>(),
GetTensorInfo().GetNumBytes());
109 void ScopedTensorHandle::CopyInFrom(
const void* memory)
111 memcpy(GetTensor<void>(), memory,
GetTensorInfo().GetNumBytes());
114 void ScopedTensorHandle::CopyFrom(
const ScopedTensorHandle& other)
116 CopyFrom(other.GetTensor<
void>(), other.GetTensorInfo().GetNumBytes());
119 void ScopedTensorHandle::CopyFrom(
const void* srcMemory,
unsigned int numBytes)
127 memcpy(GetTensor<void>(), srcMemory, numBytes);