When creating tensors, check that they have consistent types. It seems that sometimes we use float32, other times float64. It doesn't always mix well.