Open dan-zheng opened 6 years ago
is this branch still DoNotMerge?
Yes, I haven't solved the type erasure bug yet.
The problem is I can't check whether a generic type parameter T
is equal to Rep[Unit]
. I tried manifest[T] == manifest[Rep[Unit]]
and typeOf[T] =:= typeOf[Rep[Unit]]
but they result in the error No (Manifest|TypeTag) available for Rep[Unit]
.
I am not sure I understand the design of the transfer
function. In which situation can we have both Tensors and Unit? (Or Rep[Unit])
To solve that problem don't use Rep[Unit] but Unit instead, this is the same thing.
withBackend
takes a closure argument of type T => U
. I want to pattern match on T
and U
to verify whether they're valid and to determine how to perform transfer. U
can be Tensor
(or a product of Tensor
), or Unit
if the closure just does sth like print
.
I originally tried comparing with Unit
(e.g. manifest[U] == manifest[Unit]
) but it didn't evaluate to true because the actual result type was lifted to Rep[Unit]
. I'll try again.
Let's not spend cycles on this right now. Plenty of priority things to do.
Let's drop this for now. We should try to get small CNN case running on GPU ASAP
The design of
withBackend
is explained here.Non-nested invocations
withBackend
should work as expected. (Testmatrix-matrix-dot-with-backend
added in this PR is verified to work on GPU.) Nested invocations ofwithBackend
should also work, but have not yet been tested.Please do not merge until these type erasure
FIXME
s is fixed:I tried to use
TypeTag
but it didn't work:I encounter the same problem if I try to use
Manifest
:One idea is to define extra overloads for
withBackend
, but this doesn't work because it leads to ambiguity errors:Does anyone have ideas for working around type erasure? @GSAir