mirror of
https://github.com/huggingface/candle.git
synced 2025-06-21 04:10:46 +00:00
Integrate the kernels bits.
This commit is contained in:
27
kernels/src/affine.cu
Normal file
27
kernels/src/affine.cu
Normal file
@ -0,0 +1,27 @@
|
||||
extern "C" __global__ void affine_f32(
|
||||
const size_t numel,
|
||||
const float *x,
|
||||
float *y,
|
||||
const float mul,
|
||||
const float add
|
||||
) {
|
||||
unsigned int i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (i >= numel) {
|
||||
return;
|
||||
}
|
||||
y[i] = x[i] * mul + add;
|
||||
}
|
||||
|
||||
extern "C" __global__ void affine_f64(
|
||||
const size_t numel,
|
||||
const double *x,
|
||||
double *y,
|
||||
const double mul,
|
||||
const double add
|
||||
) {
|
||||
unsigned int i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (i >= numel) {
|
||||
return;
|
||||
}
|
||||
y[i] = x[i] * mul + add;
|
||||
}
|
Reference in New Issue
Block a user