internal Tensor AllocTensorInternal(DataType dataType, TensorShape shape, ITensorData buffer)
        {
            Tensor res = null;

            lock (m_AllocatedTensors)
            {
                if (m_AllocatedTensors.Count > 0)
                {
                    res = m_AllocatedTensors.Last();
                    res.Init(shape, buffer, this, dataType);
                    m_AllocatedTensors.RemoveAt(m_AllocatedTensors.Count - 1);
                }
                else
                {
                    res = new Tensor(shape, buffer, this, dataType);
                }
            }

            return(res);
        }