Add a check that scalar types of inputs are the same.