ArgMax.emadl 462 Bytes
Newer Older
1 2 3 4 5 6 7 8
package cifar10;

component ArgMax<Z(1:oo) n = 2>{
    ports in Q^{n} inputVector,
          out Z(0:oo) maxIndex;

    implementation Math{
         maxIndex = 0;
9
         Q maxValue = inputVector(0); //should be inputVector(1) but bug in EMAM2CPP
10

11
         for i = 2:n //should be 2:n but bug in EMAM2CPP
12
            if inputVector(i) > maxValue
13
                maxIndex = i - 1;
14 15 16 17 18 19
                maxValue = inputVector(i);
            end
         end
    }

}