html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/723#issuecomment-192539434,https://api.github.com/repos/pydata/xarray/issues/723,192539434,MDEyOklzc3VlQ29tbWVudDE5MjUzOTQzNA==,1217238,2016-03-05T00:47:49Z,2016-03-05T00:47:49Z,MEMBER,"Fixed by #731. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,128687346 https://github.com/pydata/xarray/issues/723#issuecomment-175383509,https://api.github.com/repos/pydata/xarray/issues/723,175383509,MDEyOklzc3VlQ29tbWVudDE3NTM4MzUwOQ==,1217238,2016-01-27T04:24:42Z,2016-01-27T04:24:42Z,MEMBER,"I'm split on whether a function or method makes more sense (`a.tensordot(b, dim='x')` vs `xr.tensordot(a, b, dim='x')`). I would be OK with either, so yes, please do go ahead! ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,128687346 https://github.com/pydata/xarray/issues/723#issuecomment-174841649,https://api.github.com/repos/pydata/xarray/issues/723,174841649,MDEyOklzc3VlQ29tbWVudDE3NDg0MTY0OQ==,5635139,2016-01-26T05:37:47Z,2016-01-26T05:37:47Z,MEMBER,"@shoyer - I thought your answer dominated mine, so I left yours as the only response. But yup, that form of `einsum` would be pretty nice... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,128687346 https://github.com/pydata/xarray/issues/723#issuecomment-174841301,https://api.github.com/repos/pydata/xarray/issues/723,174841301,MDEyOklzc3VlQ29tbWVudDE3NDg0MTMwMQ==,1217238,2016-01-26T05:34:40Z,2016-01-26T05:34:40Z,MEMBER,"@MaximilianR I do like `einsum`, but I'm not sure the API would be a good fit for xarray (we already have dimension names), and it also does not exist yet for dask (https://github.com/blaze/dask/issues/732). That said, I suppose you could make an xarray version of `einsum` with syntax that looks more like `tensordot` with `*args`, e.g., `einsum(a, b, c, dims=('x', 'y'))`. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,128687346 https://github.com/pydata/xarray/issues/723#issuecomment-174839547,https://api.github.com/repos/pydata/xarray/issues/723,174839547,MDEyOklzc3VlQ29tbWVudDE3NDgzOTU0Nw==,1217238,2016-01-26T05:27:36Z,2016-01-26T05:32:02Z,MEMBER,"Yes, this would be a nice addition! I spent a little bit of a time futzing around with this to see if there is an elegant way to plug this into our existing dispatching system. The short of it is that the answer appears to be no -- we don't have any elegant equivalent to dask.array's generic `atop` method. So, for now I would simply write a function specialized to DataArray objects. Something like the following (barely tested) is a starting point: ``` python from xarray import align, DataArray # note: using private imports (e.g., from xarray.core) is definitely discouraged! # this is not guaranteed to work in future versions of xarray from xarray.core.ops import _dask_or_eager_func def tensordot(a, b, dims): if not (isinstance(a, DataArray) and isinstance(b, DataArray)): raise ValueError a, b = align(a, b, join='inner', copy=False) axes = (a.get_axis_num(dims), b.get_axis_num(dims)) f = _dask_or_eager_func('tensordot', n_array_args=2) new_data = f(a.data, b.data, axes=axes) if isinstance(dims, basestring): dims = [dims] new_coords = a.coords.merge(b.coords).drop(dims) new_dims = ([d for d in a.dims if d not in dims] + [d for d in b.dims if d not in dims]) return DataArray(new_data, new_coords, new_dims) ``` This would be worth cleaning up so we could add it to the codebase (mostly documentation & tests). ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,128687346