dtype of count is the same as dtype of inputs[0] when created, but its type may change when multiplied by inputs[0]->shape[i]. Which causes dtype of output is not same as dtype of input.