add as_elementwise function to convert expression to elementwise