generalize tensor_of_scalars to stacklists