Make tensor.{constant,as_tensor_variable} work with memmap.

close gh-1610

- Make tensor.{constant,as_tensor_variable} work with memmap. (Christian Hudon, Frédéric Bastien)