ShigekiKarita / grain

autograd mir and CUDA library for dynamic neural networks in D.
https://shigekikarita.github.io/grain
Boost Software License 1.0
66 stars 7 forks source link

upgrade with mir-algorithm 2.0.0 #10

Closed 9il closed 5 years ago

ShigekiKarita commented 5 years ago

@9il Everything works well with mir-algorithm v2.0.1 except for grain.functions.common.maybeExpand unittest (but integrated tests in the other functions are working)

https://github.com/ShigekiKarita/grain/blob/361fc642f281d88e1dbf5be83d8fc5fe0bf05225/source/grain/functions/common.d#L223-L262

compilation error

source/grain/functions/common.d(261,12): Error: template mir.ndslice.slice.Slice!(SliceIterator!(IotaIterator!long, 2LU, cast(mir_slice_kind)2), 1LU, cast(mir_slice_kind)0).mir_slice.opEquals cannot deduce function from argument types !()(Slice!(IotaIterator!long, 3LU, cast(mir_slice_kind)1)), candidates are:
/home/karita/.dub/packages/mir-algorithm-2.0.1/mir-algorithm/source/mir/ndslice/slice.d(1758,10):        mir.ndslice.slice.Slice!(SliceIterator!(IotaIterator!long, 2LU, cast(mir_slice_kind)2), 1LU, cast(mir_slice_kind)0).mir_slice.opEquals(IteratorR, mir_slice_kind rkind)(const Slice!(IteratorR, N, rkind) rslice)
/home/karita/.dub/packages/mir-algorithm-2.0.1/mir-algorithm/source/mir/ndslice/slice.d(1777,10):        mir.ndslice.slice.Slice!(SliceIterator!(IotaIterator!long, 2LU, cast(mir_slice_kind)2), 1LU, cast(mir_slice_kind)0).mir_slice.opEquals(T)(T[] arr)
dmd failed with exit code 1.

do you have any idea?

ShigekiKarita commented 5 years ago
/// error
assert(iota(1, 3, 2).maybeExpand!0(2) == iota(3, 2).repeat(2)); 
/// ok
assert(iota(1, 3, 2).maybeExpand!0(2) == [[[0, 1], [2, 3], [4,5]], [[0, 1], [2, 3], [4,5]]]); 
9il commented 5 years ago

opEquals was disabled for ndslices of different dimension count. Does unpack help here?

ShigekiKarita commented 5 years ago

Yes! thank you.