Repository: dask/dask

Issue:
map_overlap "meta" keyword argument loses array type info of chunks
<!-- Please include a self-contained copy-pastable example that generates the issue if possible.

Please be concise with code posted. See guidelines below on how to provide a good bug report:

- Craft Minimal Bug Reports http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
- Minimal Complete Verifiable Examples https://stackoverflow.com/help/mcve

Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly.
-->

**What happened**:
`map_overlap` is inconsistent with `map_blocks` in its handling of the `meta` kwarg. When I use `meta` with `map_blocks` I get what I'd expect (i.e. the output array `_meta` matches, including the reported array type of the dask chunks). 

But when I use `meta` with `map_overlap` then the output array `_meta` attribute doesn't match - the array type of the output dask chunks is reported to be numpy arrays, even when that's not actually the case (see example below).

**What you expected to happen**:
I expected the `_meta` attribute of the output dask array to show that the array chunks are cupy (not numpy)

**Minimal Complete Verifiable Example**:
In a [google colaboratory](https://colab.research.google.com/notebooks/intro.ipynb) notebook you can run:
```python
!pip install git+https://github.com/dask/dask.git

import dask.array as da
import cupy as cp

arr = da.from_array(cp.random.random((10, 10)), chunks=5)

def plus_one(arr):
    return arr + 1

result_1 = arr.map_blocks(plus_one, meta=arr._meta)
result_2 = arr.map_overlap(plus_one, meta=arr._meta, depth=0)

print(type(result_1._meta)) # expect cupy ndarray, this is as expected
# <class 'cupy.core.core.ndarray'>
print(type(result_2._meta)) # expect cupy.ndarray, instead see numpy array reported
# <class 'numpy.ndarray'>
```

**Anything else we need to know?**:

**Environment**:

- Dask version: master branch (2.22.0+8.ge5acf325)
- Python version: 3.6.9
- Operating System: Used a [google colaboratory](https://colab.research.google.com/notebooks/intro.ipynb) notebook (for easier reproducibility)
- Install method (conda, pip, source): pip



Discussion:
cc @jakirkham for general awareness
cc @pentschev

Resolving patch:
diff --git a/dask/array/overlap.py b/dask/array/overlap.py
--- a/dask/array/overlap.py
+++ b/dask/array/overlap.py
@@ -234,7 +234,11 @@ def trim_internal(x, axes, boundary=None):
     chunks = tuple(olist)
 
     return map_blocks(
-        partial(_trim, axes=axes, boundary=boundary), x, chunks=chunks, dtype=x.dtype
+        partial(_trim, axes=axes, boundary=boundary),
+        x,
+        chunks=chunks,
+        dtype=x.dtype,
+        meta=x._meta,
     )
 
 


Test patch:
diff --git a/dask/array/tests/test_sparse.py b/dask/array/tests/test_sparse.py
--- a/dask/array/tests/test_sparse.py
+++ b/dask/array/tests/test_sparse.py
@@ -59,6 +59,8 @@
     pytest.param(lambda x: x.sum(axis=(1, 2)), marks=numpy_120_xfail),
     lambda x: x.astype(np.complex128),
     lambda x: x.map_blocks(lambda x: x * 2),
+    lambda x: x.map_overlap(lambda x: x * 2, depth=0, trim=True),
+    lambda x: x.map_overlap(lambda x: x * 2, depth=0, trim=False),
     lambda x: x.round(1),
     lambda x: x.reshape((x.shape[0] * x.shape[1], x.shape[2])),
     lambda x: abs(x),