Sha256: d93992de3ab2385c838a182a28b7da6bcf7d9833c24d7a4194318a10c77f5c4a

Contents?: true

Size: 425 Bytes

Versions: 3

Compression:

Stored size: 425 Bytes

Contents

% c_dtype = dtype_to_c_type(dtype)
% out_c_dtype = dtype_to_c_type(out_dtype)
__kernel void argmax_<%= dtype %>(__global const <%= c_dtype %> *A, __global <%= c_dtype %> *C) {
    <%= c_dtype %> max = <%= min_value_for(dtype) %>;
    <%= out_c_dtype %> max_index = 0;

    for(int i = 0; i < <%= n %>; i++) {
        if (A[i] > max) {
            max = A[i];
            max_index = i;
        }
    }
    C[0] = max_index;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tensor_stream-opencl-0.3.2 lib/tensor_stream/opencl/kernels/argmax.cl
tensor_stream-opencl-0.3.1 lib/tensor_stream/opencl/kernels/argmax.cl
tensor_stream-opencl-0.3.0 lib/tensor_stream/opencl/kernels/argmax.cl