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

close gh-1610
Merge pull request #1619 from nouiz/memmap

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