To read in and reshape the tensor elements