unaryPow

wrapper of CUDA kernel pow function

void
unaryPow
(
size_t dim
)
(
Variable!(float, dim, DeviceStorage) x
,
float power
)

Examples

test pow kernel

import numir;
import mir.ndslice;
import grain.kernel;
import mir.math : pow;

auto x = iota([2, 3], 1).as!float
    .slice
    .variable
    .to!DeviceStorage;
unaryPow(x, 2f);
assert(approxEqual(x.to!HostStorage.sliced, iota([2, 3], 1).as!float
        .map!(x => pow(x, 2))));

Meta