metal-examples-tutorials/memory/memory.playground/Resources/memory.metal

11 lines
293 B
Metal

#include <metal_stdlib>
using namespace metal;
kernel void compute(const device float *inVector [[ buffer(0) ]],
device float *outVector [[ buffer(1) ]],
uint id [[ thread_position_in_grid ]])
{
outVector[id] = 1.0 / (1.0 + exp(-inVector[id]));
}