载入中...
搜索中...
未找到
eve::tensor::kernels 命名空间参考

函数

float applyUnary (OpType t, float x, float s0, float s1)
 
bool isElementwiseOp (OpType t)
 
bool broadcastShape (const int *aDims, int aRank, const int *bDims, int bRank, int *outDims, int &outRank)
 
void binaryOp (OpType type, const float *a, const int *aDims, int aRank, const float *b, const int *bDims, int bRank, float *out, const int *outDims, int outRank)
 
void unaryOp (OpType type, const float *in, int count, float *out, float s0, float s1)
 
void softmax (const float *in, const int *dims, int rank, int axis, bool logMode, float *out)
 
void layernorm (const float *in, int rows, int cols, const float *scale, const float *bias, float eps, float *out)
 
void rmsnorm (const float *in, int rows, int cols, const float *scale, float eps, float *out)
 
void conv1d (const float *x, const int *xDims, const float *w, const int *wDims, const float *bias, int stride, int pad, float *out)
 
void conv2d (const float *x, const int *xDims, const float *w, const int *wDims, const float *bias, int stride, int pad, float *out)
 
void maxpool2d (const float *in, const int *dims, int ksize, int stride, int pad, float *out)
 
void avgpool2d (const float *in, const int *dims, int ksize, int stride, int pad, float *out)
 
void embedding (const float *table, int vocab, int dim, const float *indices, int count, float *out)
 
void concat (const float *const *ins, const int *const *inDims, const int *inRanks, int n, int axis, float *out, const int *outDims, int outRank)
 
void sliceOp (const float *in, const int *inDims, int inRank, int axis, int begin, int end, float *out, const int *outDims, int outRank)
 
void permute (const float *in, const int *inDims, int rank, const int *order, float *out, const int *outDims)
 
void reduceAxis (OpType type, const float *in, const int *dims, int rank, int axis, float *out, const int *outDims, int outRank)
 
void argmax (const float *in, const int *dims, int rank, int axis, float *out, const int *outDims, int outRank)
 
void sdpa (const float *q, const float *k, const float *v, const float *mask, int B, int H, int T, int S, int D, float scale, float *out)
 
void resize2d (const float *in, const int *inDims, int outW, int outH, int mode, float *out)
 

详细描述

CPU reference kernels shared by the eager path and the graph interpreter.

All shapes are static, row-major, rank <= Tensor::kMaxRank. Every entry point is a plain loop implementation: correctness / portability first, throughput is provided by the generated GPU kernels when a Vulkan device is available.

函数说明

◆ applyUnary()

◆ argmax()

void eve::tensor::kernels::argmax ( const float *  in,
const int *  dims,
int  rank,
int  axis,
float *  out,
const int *  outDims,
int  outRank 
)

在文件 CpuKernels.cpp428 行定义.

引用了 reduce , 以及 v.

被这些函数引用 eve::tensor::TF::argmax().

◆ avgpool2d()

void eve::tensor::kernels::avgpool2d ( const float *  in,
const int *  dims,
int  ksize,
int  stride,
int  pad,
float *  out 
)

在文件 CpuKernels.cpp302 行定义.

引用了 c, n , 以及 valid.

被这些函数引用 eve::tensor::TF::avgpool2d().

◆ binaryOp()

void eve::tensor::kernels::binaryOp ( OpType  type,
const float *  a,
const int *  aDims,
int  aRank,
const float *  b,
const int *  bDims,
int  bRank,
float *  out,
const int *  outDims,
int  outRank 
)

Elementwise binary op with broadcasting.

在文件 CpuKernels.cpp136 行定义.

引用了 a, b, eve::tensor::Tensor::kMaxRank , 以及 type.

◆ broadcastShape()

bool eve::tensor::kernels::broadcastShape ( const int *  aDims,
int  aRank,
const int *  bDims,
int  bRank,
int *  outDims,
int &  outRank 
)

Broadcast two shapes to a common shape. Returns false when incompatible.

在文件 CpuKernels.cpp120 行定义.

引用了 eve::tensor::Tensor::kMaxRank.

被这些函数引用 eve::tensor::Func::emitBinary().

◆ concat()

void eve::tensor::kernels::concat ( const float *const *  ins,
const int *const *  inDims,
const int *  inRanks,
int  n,
int  axis,
float *  out,
const int *  outDims,
int  outRank 
)

concat n (2..4) tensors along axis; all other dims must match out dims.

在文件 CpuKernels.cpp336 行定义.

引用了 n , 以及 v.

◆ conv1d()

void eve::tensor::kernels::conv1d ( const float *  x,
const int *  xDims,
const float *  w,
const int *  wDims,
const float *  bias,
int  stride,
int  pad,
float *  out 
)

在文件 CpuKernels.cpp230 行定义.

引用了 c, f, n, w , 以及 x.

被这些函数引用 eve::tensor::TF::conv1dBias().

◆ conv2d()

void eve::tensor::kernels::conv2d ( const float *  x,
const int *  xDims,
const float *  w,
const int *  wDims,
const float *  bias,
int  stride,
int  pad,
float *  out 
)

在文件 CpuKernels.cpp252 行定义.

引用了 c, f, n, w , 以及 x.

被这些函数引用 eve::tensor::TF::conv2dBias().

◆ embedding()

void eve::tensor::kernels::embedding ( const float *  table,
int  vocab,
int  dim,
const float *  indices,
int  count,
float *  out 
)

table [vocab x dim], indices [count] -> out [count x dim]. Indices are clamped.

在文件 CpuKernels.cpp325 行定义.

引用了 d , 以及 idx.

被这些函数引用 eve::tensor::TF::embedding().

◆ isElementwiseOp()

◆ layernorm()

void eve::tensor::kernels::layernorm ( const float *  in,
int  rows,
int  cols,
const float *  scale,
const float *  bias,
float  eps,
float *  out 
)

在文件 CpuKernels.cpp187 行定义.

引用了 c, scale, v , 以及 y.

被这些函数引用 eve::tensor::TF::layernorm() , 以及 eve::tensor::TF::layernormWB().

◆ maxpool2d()

void eve::tensor::kernels::maxpool2d ( const float *  in,
const int *  dims,
int  ksize,
int  stride,
int  pad,
float *  out 
)

在文件 CpuKernels.cpp282 行定义.

引用了 c , 以及 n.

被这些函数引用 eve::tensor::TF::maxpool2d().

◆ permute()

void eve::tensor::kernels::permute ( const float *  in,
const int *  inDims,
int  rank,
const int *  order,
float *  out,
const int *  outDims 
)

在文件 CpuKernels.cpp382 行定义.

引用了 idx , 以及 eve::tensor::Tensor::kMaxRank.

被这些函数引用 eve::tensor::Tensor::permute().

◆ reduceAxis()

void eve::tensor::kernels::reduceAxis ( OpType  type,
const float *  in,
const int *  dims,
int  rank,
int  axis,
float *  out,
const int *  outDims,
int  outRank 
)

sum/mean/min/max along axis (out dims must already be computed by caller).

在文件 CpuKernels.cpp401 行定义.

引用了 reduce, eve::tensor::ReduceMax, eve::tensor::ReduceMean, eve::tensor::ReduceMin, eve::tensor::ReduceSum, type , 以及 v.

◆ resize2d()

void eve::tensor::kernels::resize2d ( const float *  in,
const int *  inDims,
int  outW,
int  outH,
int  mode,
float *  out 
)

resize2d NCHW; mode: 0 = nearest, 1 = bilinear.

在文件 CpuKernels.cpp488 行定义.

引用了 c, n, value, x , 以及 y.

被这些函数引用 eve::tensor::TF::resize2d().

◆ rmsnorm()

void eve::tensor::kernels::rmsnorm ( const float *  in,
int  rows,
int  cols,
const float *  scale,
float  eps,
float *  out 
)

在文件 CpuKernels.cpp211 行定义.

引用了 c , 以及 scale.

被这些函数引用 eve::tensor::TF::rmsnorm() , 以及 eve::tensor::TF::rmsnormW().

◆ sdpa()

void eve::tensor::kernels::sdpa ( const float *  q,
const float *  k,
const float *  v,
const float *  mask,
int  B,
int  H,
int  T,
int  S,
int  D,
float  scale,
float *  out 
)

Scaled dot-product attention over the last two dims: q [B,H,T,D], k [B,H,S,D], v [B,H,S,D], mask [B,H,T,S] (optional, may be null).

在文件 CpuKernels.cpp454 行定义.

引用了 b, d, h, s, scale , 以及 v.

被这些函数引用 eve::tensor::TF::sdpaMasked().

◆ sliceOp()

void eve::tensor::kernels::sliceOp ( const float *  in,
const int *  inDims,
int  inRank,
int  axis,
int  begin,
int  end,
float *  out,
const int *  outDims,
int  outRank 
)

在文件 CpuKernels.cpp365 行定义.

被这些函数引用 eve::tensor::TF::slice().

◆ softmax()

void eve::tensor::kernels::softmax ( const float *  in,
const int *  dims,
int  rank,
int  axis,
bool  logMode,
float *  out 
)

在文件 CpuKernels.cpp163 行定义.

引用了 reduce , 以及 v.

被这些函数引用 eve::tensor::TF::logSoftmax() , 以及 eve::tensor::TF::softmax().

◆ unaryOp()

void eve::tensor::kernels::unaryOp ( OpType  type,
const float *  in,
int  count,
float *  out,
float  s0,
float  s1 
)