FoldΒΆ
Fold is a control node which takes an initial value and many scalar values and combines them into one value using some associative operator. Unless otherwise disabled, the compiler will attempt to automatically pipeline and parallelize Fold nodes. A Fold consists of a map function, which is responsible for producing the scalar values, and a reduction function to describe how the values should be combined.
Calling any form of Fold returns the accumulator which, at the end of the loop, will contain the final result of the reduction.
Static methods
object Fold | |
---|---|
def apply[T](initial: T)(ctr1: Counter, ctr2: Counter, ctr3: Counter, ctr4: Counter, ctr5: Counter*)(map: List[Int] => T)(reduce: (T,T) => T): Reg[T]
Fold over an 4+ dimensional space with implicit accumulator but explicit initial value.
Returns the accumulator used to implement this reduction.
Note that the map function is on a List of iterators.
The number of iterators will be the same as the number of counters supplied.
|
|
def apply[T](accum: Reg[T])(ctr1: Counter, ctr2: Counter, ctr3: Counter, ctr4: Counter, ctr5: Counter*)(map: List[Int] => T)(reduce: (T,T) => T): Reg[T]
Fold over an 4+ dimensional space with explicit accumulator.
Returns the accumulator used to implement this reduction.
Note that the map function is on a List of iterators.
The number of iterators will be the same as the number of counters supplied.
|