Updating memref.cast check regarding if input and output are valid for casting. Currently in case of casting between dynamic and static dims with different strides, the return value of the check is not symmetric and depends if casting for dynamic to static or vice versa. Updating the check logic to make this symmetric.