Possible memory leak in 0-dimensional tensors

Hi Alexandre, thanks for your explanations.

As I understand you, it is not techniacally possible to create empty ComputeBuffers.
However, when initializeing a new tensor (for example TensorInt a = TensorInt.Zeros(new TensorShape(0))), i guess, its tensorOnDevice attribute points to an empty array/computebuffer (CPU array [0] / GPU:(0) buffer: UnityEngine.ComputeBuffer).

From my perspective there is no general problem with 0 dimensional tensors. My specific problem is that the 0-dimensional result tensor of the gather operation however has null on its tensorOnDevice attribute (which seems like a bug to me). I revised the code again to better describe the exact problem and the corresponding log output:

ITensorAllocator allocator = new TensorCachingAllocator();
Ops opsCPU = WorkerFactory.CreateOps(BackendType.CPU, allocator);

TensorInt a = new TensorInt(new TensorShape(3), new int[] { 0, 1, 2 });
TensorInt b = TensorInt.Zeros(new TensorShape(0));
Tensor c = opsCPU.Gather(a, b, 0);

Debug.LogFormat("CPU b.shape: {0}; b.tensorOnDevice: {1}", b.shape, b.tensorOnDevice);
Debug.LogFormat("CPU c.shape: {0}; c.tensorOnDevice: {1}", c.shape, c.tensorOnDevice);


Ops opsGPU = WorkerFactory.CreateOps(BackendType.GPUCompute, allocator);
Tensor cGPU = opsGPU.Gather(a, b, 0);

Debug.LogFormat("GPU b.shape: {0}; b.tensorOnDevice: {1}", b.shape, b.tensorOnDevice);
Debug.LogFormat("GPU c.shape: {0}; c.tensorOnDevice: {1}", cGPU.shape, cGPU.tensorOnDevice);

The corresponding log is: