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

函数

float applyUnary (OpType type, float x, float s0, float s1)
 Applies unary.
 
bool isElementwiseOp (OpType type)
 True when elementwise op.
 
bool broadcastShape (const int *aDims, int aRank, const int *bDims, int bRank, int *outDims, int &outRank)
 Broadcast shape.
 
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)
 Binary op.
 
void unaryOp (OpType type, const float *in, int count, float *out, float s0, float s1)
 Unary op.
 
void softmax (const float *in, const int *dims, int rank, int axis, bool logMode, float *out)
 Softmax.
 
void layernorm (const float *in, int rows, int cols, const float *scale, const float *bias, float eps, float *out)
 Layernorm.
 
void rmsnorm (const float *in, int rows, int cols, const float *scale, float eps, float *out)
 Rmsnorm.
 
void conv1d (const float *x, const int *xDims, const float *w, const int *wDims, const float *bias, int stride, int pad, float *out)
 Conv 1 d.
 
void conv2d (const float *x, const int *xDims, const float *w, const int *wDims, const float *bias, int stride, int pad, float *out)
 Conv 2 d.
 
void maxpool2d (const float *in, const int *dims, int ksize, int stride, int pad, float *out)
 Maxpool 2 d.
 
void avgpool2d (const float *in, const int *dims, int ksize, int stride, int pad, float *out)
 Avgpool 2 d.
 
void embedding (const float *table, int vocab, int dim, const float *indices, int count, float *out)
 Embedding.
 
void concat (const float *const *ins, const int *const *inDims, const int *inRanks, int n, int axis, float *out, const int *outDims, int outRank)
 Concat.
 
void sliceOp (const float *in, const int *inDims, int inRank, int axis, int begin, int end, float *out, const int *outDims, int outRank)
 Slice op.
 
void permute (const float *in, const int *inDims, int rank, const int *order, float *out, const int *outDims)
 Permute.
 
void reduceAxis (OpType type, const float *in, const int *dims, int rank, int axis, float *out, const int *outDims, int outRank)
 Reduce axis.
 
void argmax (const float *in, const int *dims, int rank, int axis, float *out, const int *outDims, int outRank)
 Argmax.
 
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)
 Sdpa.
 
void resize2d (const float *in, const int *inDims, int outW, int outH, int mode, float *out)
 Resize 2 d.
 

详细描述

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 
)

Argmax.

在文件 CpuKernels.cpp 第 428 行定义.

引用了 best, r, reduce, rows , 以及 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 
)

Avgpool 2 d.

在文件 CpuKernels.cpp 第 302 行定义.

引用了 c, n, pad , 以及 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 
)

Binary op.

Elementwise binary op with broadcasting.

在文件 CpuKernels.cpp 第 136 行定义.

引用了 a, b, count, 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 shape.

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

在文件 CpuKernels.cpp 第 120 行定义.

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

被这些函数引用 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.

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

在文件 CpuKernels.cpp 第 336 行定义.

引用了 ax, count, n, sz , 以及 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 
)

Conv 1 d.

在文件 CpuKernels.cpp 第 230 行定义.

引用了 bias, c, f, n, pad, 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 
)

Conv 2 d.

在文件 CpuKernels.cpp 第 252 行定义.

引用了 bias, c, f, n, pad, 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 
)

Embedding.

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

在文件 CpuKernels.cpp 第 325 行定义.

引用了 count, d, idx, indices , 以及 r.

被这些函数引用 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 
)

Layernorm.

在文件 CpuKernels.cpp 第 187 行定义.

引用了 bias, c, cols, r, rows, 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 
)

Maxpool 2 d.

在文件 CpuKernels.cpp 第 282 行定义.

引用了 best, c, n , 以及 pad.

被这些函数引用 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 
)

Permute.

在文件 CpuKernels.cpp 第 382 行定义.

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

被这些函数引用 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 
)

Reduce axis.

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

在文件 CpuKernels.cpp 第 401 行定义.

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

◆ resize2d()

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

Resize 2 d.

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

在文件 CpuKernels.cpp 第 488 行定义.

引用了 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 
)

Rmsnorm.

在文件 CpuKernels.cpp 第 211 行定义.

引用了 c, cols, r, rows , 以及 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 
)

Sdpa.

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.cpp 第 454 行定义.

引用了 b, d, h, mask, q, s, scale, score, t , 以及 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 
)

Slice op.

在文件 CpuKernels.cpp 第 365 行定义.

引用了 ax, begin, count , 以及 end.

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

◆ softmax()

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

Softmax.

在文件 CpuKernels.cpp 第 163 行定义.

引用了 r, reduce, rows , 以及 v.

被这些函数引用 eve::tensor::onnx_detail::execute(), 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 
)