num_scalars gets involved
Implementing same example as in python code