Skip to content

Create Tensor::isScalar() method for better disambiguation

!162 (merged) aimed to disambiguate between empty tensors & scalar tensors. This proposition builds on top of it as we can further simplify the interface.

As of now checking if a tensor is scalar is done as follows : aidge_backend_cpu!75 (diffs).

Unless you take a good look at what happens between Tensor::empty() & Tensor::undefined() it is not easy to understand that we are dealing with a scalar tensor here.

Hence I propose to add the following method to easier code reading

bool Tensor::isScalar() { return empty() && mSize == 1 }
Edited by Grégoire Kubler