Open ctongfei opened 5 years ago
Amazing idea from @kitsing:
A LongTensor tensor used as an indexer should not be typed as LongTensor[U], instead it should be IndexTensor[U, X <: Dim], where X is the single dimension which it is indexed against. This creates extra typesafety:
LongTensor
LongTensor[U]
IndexTensor[U, X <: Dim]
oneHot: TI[U, I] => TR[Append[U, I]] argmax: (T[U], I) => TI[Remove[U, I], I]
Amazing idea from @kitsing:
A
LongTensor
tensor used as an indexer should not be typed asLongTensor[U]
, instead it should beIndexTensor[U, X <: Dim]
, where X is the single dimension which it is indexed against. This creates extra typesafety: