载入中...
搜索中...
未找到

float32 / int32 tensor (rank 1–6), row-major. Eager: owns a buffer. Symbolic: node in a Func graph (no buffer until run). 更多...

#include <Tensor.h>

Public 成员函数

 Tensor ()=default
 
 Tensor (const int *dims, int rank)
 从 dims[0..rank) 创建 eager 张量。
 
 Tensor (DType dtype, const int *dims, int rank)
 
 Tensor (int d0)
 按秩创建全零 eager 张量。
 
 Tensor (int d0, int d1)
 
 Tensor (int d0, int d1, int d2)
 
 Tensor (int d0, int d1, int d2, int d3)
 
 Tensor (int d0, int d1, int d2, int d3, int d4)
 
 Tensor (int d0, int d1, int d2, int d3, int d4, int d5)
 
bool isSymbolic () const
 
bool isEager () const
 
Graphgraph () const
 
int nodeId () const
 
int getRank () const
 
int getSize () const
 
int getDim (int axis) const
 
int getDim0 () const
 
int getDim1 () const
 
int getDim2 () const
 
int getDim3 () const
 
int getDim4 () const
 
int getDim5 () const
 
std::string getDevice () const
 
std::string getDtype () const
 
DType dtype () const
 
void setDtype (DType dtype)
 
bool isQuantized () const
 
std::vector< float > dequantized () const
 
const std::vector< float > & qScales () const
 
int qGroup () const
 
const std::vector< uint8_t > & qBytes () const
 
float get (int flatIndex) const
 
void set (int flatIndex, float value)
 
float get1 (int i0) const
 
void set1 (int i0, float value)
 
float get2 (int i0, int i1) const
 
void set2 (int i0, int i1, float value)
 
float get3 (int i0, int i1, int i2) const
 
void set3 (int i0, int i1, int i2, float value)
 
float get4 (int i0, int i1, int i2, int i3) const
 
void set4 (int i0, int i1, int i2, int i3, float value)
 
float get5 (int i0, int i1, int i2, int i3, int i4) const
 
void set5 (int i0, int i1, int i2, int i3, int i4, float value)
 
float get6 (int i0, int i1, int i2, int i3, int i4, int i5) const
 
void set6 (int i0, int i1, int i2, int i3, int i4, int i5, float value)
 
void fill (float value)
 
void copyFrom (const Tensor *other)
 
Tensorclone () const
 
Tensoradd (const Tensor *other) const
 Eager 逐元素运算(符号张量会抛异常)。
 
Tensorsub (const Tensor *other) const
 
Tensormultiply (const Tensor *other) const
 
Tensordiv (const Tensor *other) const
 
TensoraddScalar (float s) const
 
TensorsubScalar (float s) const
 
TensormulScalar (float s) const
 
TensordivScalar (float s) const
 
Tensorneg () const
 
Tensorabs () const
 
Tensorsqrt () const
 
Tensorexp () const
 
Tensorlog () const
 
Tensorsin () const
 
Tensorcos () const
 
Tensortanh () const
 
Tensorrelu () const
 
Tensorsigmoid () const
 
Tensorgelu () const
 
Tensorsilu () const
 
TensorpowScalar (float exp) const
 
Tensorclamp (float lo, float hi) const
 
TensormaximumScalar (float s) const
 
TensorminimumScalar (float s) const
 
void addInPlace (const Tensor *other)
 Eager 原地运算。
 
void multiplyInPlace (const Tensor *other)
 
void addScalarInPlace (float s)
 
void mulScalarInPlace (float s)
 
void reluInPlace ()
 
float reduceSum () const
 归约:求和 / 均值 / 最小 / 最大。
 
float reduceMean () const
 
float reduceMin () const
 
float reduceMax () const
 
float dot (const Tensor *other) const
 
Tensormatmul (const Tensor *other) const
 矩阵乘法 / 转置 / 变形。
 
Tensortranspose () const
 
Tensorpermute (const int *order, int rank) const
 
Tensorreshape1 (int d0) const
 
Tensorreshape2 (int d0, int d1) const
 
Tensorreshape3 (int d0, int d1, int d2) const
 
Tensorreshape4 (int d0, int d1, int d2, int d3) const
 
Tensorreshape5 (int d0, int d1, int d2, int d3, int d4) const
 
Tensorreshape6 (int d0, int d1, int d2, int d3, int d4, int d5) const
 
Tensorflatten () const
 
float * data ()
 原始数据指针(eager)。
 
const float * data () const
 
void ensureEager (const char *op) const
 

静态 Public 成员函数

static TensormakeSymbolic (Graph *graph, int nodeId, const int *dims, int rank)
 Symbolic handle into a graph node.
 
static int product (const int *dims, int rank)
 

静态 Public 属性

static constexpr int kMaxRank = 6
 

友元

class TF
 
class Func
 
class CompiledFunction
 
class Graph
 

详细描述

float32 / int32 tensor (rank 1–6), row-major. Eager: owns a buffer. Symbolic: node in a Func graph (no buffer until run).

在文件 Tensor.h43 行定义.

构造及析构函数说明

◆ Tensor() [1/9]

◆ Tensor() [2/9]

eve::tensor::Tensor::Tensor ( const int *  dims,
int  rank 
)
explicit

从 dims[0..rank) 创建 eager 张量。

在文件 Tensor.cpp95 行定义.

引用了 eve::tensor::Float32.

◆ Tensor() [3/9]

eve::tensor::Tensor::Tensor ( DType  dtype,
const int *  dims,
int  rank 
)
explicit

在文件 Tensor.cpp96 行定义.

引用了 dtype().

◆ Tensor() [4/9]

eve::tensor::Tensor::Tensor ( int  d0)

按秩创建全零 eager 张量。

在文件 Tensor.cpp97 行定义.

引用了 d , 以及 eve::tensor::Float32.

◆ Tensor() [5/9]

eve::tensor::Tensor::Tensor ( int  d0,
int  d1 
)

在文件 Tensor.cpp101 行定义.

引用了 d , 以及 eve::tensor::Float32.

◆ Tensor() [6/9]

eve::tensor::Tensor::Tensor ( int  d0,
int  d1,
int  d2 
)

在文件 Tensor.cpp105 行定义.

引用了 d , 以及 eve::tensor::Float32.

◆ Tensor() [7/9]

eve::tensor::Tensor::Tensor ( int  d0,
int  d1,
int  d2,
int  d3 
)

在文件 Tensor.cpp109 行定义.

引用了 d , 以及 eve::tensor::Float32.

◆ Tensor() [8/9]

eve::tensor::Tensor::Tensor ( int  d0,
int  d1,
int  d2,
int  d3,
int  d4 
)

在文件 Tensor.cpp113 行定义.

引用了 d , 以及 eve::tensor::Float32.

◆ Tensor() [9/9]

eve::tensor::Tensor::Tensor ( int  d0,
int  d1,
int  d2,
int  d3,
int  d4,
int  d5 
)

在文件 Tensor.cpp117 行定义.

引用了 d , 以及 eve::tensor::Float32.

成员函数说明

◆ abs()

Tensor * eve::tensor::Tensor::abs ( ) const

◆ add()

Tensor * eve::tensor::Tensor::add ( const Tensor other) const

Eager 逐元素运算(符号张量会抛异常)。

在文件 Tensor.cpp319 行定义.

引用了 eve::tensor::Add.

◆ addInPlace()

void eve::tensor::Tensor::addInPlace ( const Tensor other)

Eager 原地运算。

在文件 Tensor.cpp400 行定义.

引用了 a, b , 以及 ensureEager().

◆ addScalar()

Tensor * eve::tensor::Tensor::addScalar ( float  s) const

◆ addScalarInPlace()

void eve::tensor::Tensor::addScalarInPlace ( float  s)

在文件 Tensor.cpp418 行定义.

引用了 a, ensureEager() , 以及 s.

◆ clamp()

Tensor * eve::tensor::Tensor::clamp ( float  lo,
float  hi 
) const

◆ clone()

Tensor * eve::tensor::Tensor::clone ( ) const

在文件 Tensor.cpp281 行定义.

引用了 ensureEager() , 以及 Tensor().

◆ copyFrom()

void eve::tensor::Tensor::copyFrom ( const Tensor other)

在文件 Tensor.cpp272 行定义.

引用了 ensureEager().

◆ cos()

Tensor * eve::tensor::Tensor::cos ( ) const

◆ data() [1/2]

float * eve::tensor::Tensor::data ( )

◆ data() [2/2]

const float * eve::tensor::Tensor::data ( ) const

在文件 Tensor.cpp190 行定义.

引用了 ensureEager() , 以及 isQuantized().

◆ dequantized()

std::vector< float > eve::tensor::Tensor::dequantized ( ) const

Dequantize this tensor to float32 (eager only).

在文件 Tensor.cpp210 行定义.

引用了 eve::tensor::q::dequantizeAll(), ensureEager() , 以及 isQuantized().

被这些函数引用 eve::tensor::TF::embedding(), matmul() , 以及 transpose().

◆ div()

Tensor * eve::tensor::Tensor::div ( const Tensor other) const

在文件 Tensor.cpp324 行定义.

引用了 eve::tensor::Divide.

◆ divScalar()

Tensor * eve::tensor::Tensor::divScalar ( float  s) const

◆ dot()

float eve::tensor::Tensor::dot ( const Tensor other) const

在文件 Tensor.cpp464 行定义.

引用了 a, b , 以及 ensureEager().

◆ dtype()

DType eve::tensor::Tensor::dtype ( ) const
inline

在文件 Tensor.h78 行定义.

被这些函数引用 setDtype() , 以及 Tensor().

◆ ensureEager()

◆ exp()

Tensor * eve::tensor::Tensor::exp ( ) const

被这些函数引用 powScalar().

◆ fill()

void eve::tensor::Tensor::fill ( float  value)

在文件 Tensor.cpp267 行定义.

引用了 ensureEager() , 以及 value.

◆ flatten()

Tensor * eve::tensor::Tensor::flatten ( ) const

在文件 Tensor.cpp615 行定义.

引用了 reshape1().

◆ gelu()

Tensor * eve::tensor::Tensor::gelu ( ) const

◆ get()

float eve::tensor::Tensor::get ( int  flatIndex) const

在文件 Tensor.cpp196 行定义.

引用了 eve::tensor::q::dequantValue(), ensureEager() , 以及 isQuantized().

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

◆ get1()

float eve::tensor::Tensor::get1 ( int  i0) const

在文件 Tensor.cpp218 行定义.

引用了 get() , 以及 i0.

◆ get2()

float eve::tensor::Tensor::get2 ( int  i0,
int  i1 
) const

在文件 Tensor.cpp226 行定义.

引用了 ensureEager(), i0 , 以及 i1.

◆ get3()

float eve::tensor::Tensor::get3 ( int  i0,
int  i1,
int  i2 
) const

在文件 Tensor.cpp234 行定义.

引用了 ensureEager(), i0, i1 , 以及 i2.

◆ get4()

float eve::tensor::Tensor::get4 ( int  i0,
int  i1,
int  i2,
int  i3 
) const

在文件 Tensor.cpp242 行定义.

引用了 ensureEager(), i0, i1 , 以及 i2.

◆ get5()

float eve::tensor::Tensor::get5 ( int  i0,
int  i1,
int  i2,
int  i3,
int  i4 
) const

在文件 Tensor.cpp250 行定义.

引用了 ensureEager(), i0, i1 , 以及 i2.

◆ get6()

float eve::tensor::Tensor::get6 ( int  i0,
int  i1,
int  i2,
int  i3,
int  i4,
int  i5 
) const

在文件 Tensor.cpp258 行定义.

引用了 ensureEager(), i0, i1 , 以及 i2.

◆ getDevice()

std::string eve::tensor::Tensor::getDevice ( ) const
inline

在文件 Tensor.h76 行定义.

◆ getDim()

int eve::tensor::Tensor::getDim ( int  axis) const

在文件 Tensor.cpp141 行定义.

被这些函数引用 eve::tensor::TF::embedding(), eve::tensor::TF::sdpaMasked() , 以及 eve::tensor::TF::where().

◆ getDim0()

int eve::tensor::Tensor::getDim0 ( ) const
inline

在文件 Tensor.h70 行定义.

◆ getDim1()

int eve::tensor::Tensor::getDim1 ( ) const
inline

在文件 Tensor.h71 行定义.

◆ getDim2()

int eve::tensor::Tensor::getDim2 ( ) const
inline

在文件 Tensor.h72 行定义.

◆ getDim3()

int eve::tensor::Tensor::getDim3 ( ) const
inline

在文件 Tensor.h73 行定义.

◆ getDim4()

int eve::tensor::Tensor::getDim4 ( ) const
inline

在文件 Tensor.h74 行定义.

◆ getDim5()

int eve::tensor::Tensor::getDim5 ( ) const
inline

在文件 Tensor.h75 行定义.

◆ getDtype()

std::string eve::tensor::Tensor::getDtype ( ) const
inline

在文件 Tensor.h77 行定义.

引用了 eve::tensor::dtypeName().

◆ getRank()

int eve::tensor::Tensor::getRank ( ) const
inline

在文件 Tensor.h67 行定义.

被这些函数引用 eve::tensor::TF::embedding(), eve::tensor::TF::sdpaMasked() , 以及 eve::tensor::TF::where().

◆ getSize()

◆ graph()

Graph * eve::tensor::Tensor::graph ( ) const
inline

在文件 Tensor.h64 行定义.

被这些函数引用 eve::tensor::Func::ensureNode() , 以及 makeSymbolic().

◆ isEager()

bool eve::tensor::Tensor::isEager ( ) const
inline

在文件 Tensor.h63 行定义.

◆ isQuantized()

bool eve::tensor::Tensor::isQuantized ( ) const
inline

True for packed weight-quantization dtypes (bytes_, qScales_).

在文件 Tensor.h82 行定义.

引用了 eve::tensor::q::isQuantDType().

被这些函数引用 data(), data(), dequantized(), eve::tensor::TF::embedding(), eve::tensor::Func::ensureNode(), get(), matmul(), permute(), set() , 以及 transpose().

◆ isSymbolic()

bool eve::tensor::Tensor::isSymbolic ( ) const
inline

在文件 Tensor.h62 行定义.

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

◆ log()

Tensor * eve::tensor::Tensor::log ( ) const

◆ makeSymbolic()

Tensor * eve::tensor::Tensor::makeSymbolic ( Graph graph,
int  nodeId,
const int *  dims,
int  rank 
)
static

Symbolic handle into a graph node.

在文件 Tensor.cpp122 行定义.

引用了 eve::tensor::Float32, graph(), kMaxRank, nodeId() , 以及 Tensor().

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

◆ matmul()

Tensor * eve::tensor::Tensor::matmul ( const Tensor other) const

矩阵乘法 / 转置 / 变形。

在文件 Tensor.cpp475 行定义.

引用了 a, b, c, dequantized(), ensureEager(), isQuantized(), m, n , 以及 Tensor().

◆ maximumScalar()

Tensor * eve::tensor::Tensor::maximumScalar ( float  s) const

◆ minimumScalar()

Tensor * eve::tensor::Tensor::minimumScalar ( float  s) const

◆ mulScalar()

Tensor * eve::tensor::Tensor::mulScalar ( float  s) const

◆ mulScalarInPlace()

void eve::tensor::Tensor::mulScalarInPlace ( float  s)

在文件 Tensor.cpp424 行定义.

引用了 a, ensureEager() , 以及 s.

◆ multiply()

Tensor * eve::tensor::Tensor::multiply ( const Tensor other) const

在文件 Tensor.cpp321 行定义.

引用了 eve::tensor::Multiply.

◆ multiplyInPlace()

void eve::tensor::Tensor::multiplyInPlace ( const Tensor other)

在文件 Tensor.cpp409 行定义.

引用了 a, b , 以及 ensureEager().

◆ neg()

Tensor * eve::tensor::Tensor::neg ( ) const

◆ nodeId()

int eve::tensor::Tensor::nodeId ( ) const
inline

在文件 Tensor.h65 行定义.

被这些函数引用 eve::tensor::Func::ensureNode() , 以及 makeSymbolic().

◆ permute()

Tensor * eve::tensor::Tensor::permute ( const int *  order,
int  rank 
) const

在文件 Tensor.cpp545 行定义.

引用了 ensureEager(), isQuantized(), kMaxRank, eve::tensor::kernels::permute() , 以及 Tensor().

被这些函数引用 transpose().

◆ powScalar()

Tensor * eve::tensor::Tensor::powScalar ( float  exp) const

◆ product()

int eve::tensor::Tensor::product ( const int *  dims,
int  rank 
)
static

在文件 Tensor.cpp71 行定义.

◆ qBytes()

const std::vector< uint8_t > & eve::tensor::Tensor::qBytes ( ) const
inline

在文件 Tensor.h90 行定义.

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

◆ qGroup()

int eve::tensor::Tensor::qGroup ( ) const
inline

在文件 Tensor.h89 行定义.

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

◆ qScales()

const std::vector< float > & eve::tensor::Tensor::qScales ( ) const
inline

Per-group scale vector + group size for quantized tensors.

在文件 Tensor.h88 行定义.

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

◆ reduceMax()

float eve::tensor::Tensor::reduceMax ( ) const

在文件 Tensor.cpp456 行定义.

引用了 ensureEager() , 以及 m.

◆ reduceMean()

float eve::tensor::Tensor::reduceMean ( ) const

在文件 Tensor.cpp444 行定义.

引用了 reduceSum().

◆ reduceMin()

float eve::tensor::Tensor::reduceMin ( ) const

在文件 Tensor.cpp448 行定义.

引用了 ensureEager() , 以及 m.

◆ reduceSum()

float eve::tensor::Tensor::reduceSum ( ) const

归约:求和 / 均值 / 最小 / 最大。

在文件 Tensor.cpp437 行定义.

引用了 ensureEager().

被这些函数引用 reduceMean().

◆ relu()

Tensor * eve::tensor::Tensor::relu ( ) const

◆ reluInPlace()

void eve::tensor::Tensor::reluInPlace ( )

在文件 Tensor.cpp430 行定义.

引用了 a , 以及 ensureEager().

◆ reshape1()

Tensor * eve::tensor::Tensor::reshape1 ( int  d0) const

在文件 Tensor.cpp561 行定义.

引用了 ensureEager() , 以及 Tensor().

被这些函数引用 flatten().

◆ reshape2()

Tensor * eve::tensor::Tensor::reshape2 ( int  d0,
int  d1 
) const

在文件 Tensor.cpp569 行定义.

引用了 d, ensureEager() , 以及 Tensor().

◆ reshape3()

Tensor * eve::tensor::Tensor::reshape3 ( int  d0,
int  d1,
int  d2 
) const

在文件 Tensor.cpp578 行定义.

引用了 d, ensureEager() , 以及 Tensor().

◆ reshape4()

Tensor * eve::tensor::Tensor::reshape4 ( int  d0,
int  d1,
int  d2,
int  d3 
) const

在文件 Tensor.cpp587 行定义.

引用了 d, ensureEager() , 以及 Tensor().

◆ reshape5()

Tensor * eve::tensor::Tensor::reshape5 ( int  d0,
int  d1,
int  d2,
int  d3,
int  d4 
) const

在文件 Tensor.cpp596 行定义.

引用了 d, ensureEager() , 以及 Tensor().

◆ reshape6()

Tensor * eve::tensor::Tensor::reshape6 ( int  d0,
int  d1,
int  d2,
int  d3,
int  d4,
int  d5 
) const

在文件 Tensor.cpp605 行定义.

引用了 d, ensureEager() , 以及 Tensor().

◆ set()

void eve::tensor::Tensor::set ( int  flatIndex,
float  value 
)

在文件 Tensor.cpp203 行定义.

引用了 ensureEager(), isQuantized() , 以及 value.

被这些函数引用 set1().

◆ set1()

void eve::tensor::Tensor::set1 ( int  i0,
float  value 
)

在文件 Tensor.cpp222 行定义.

引用了 i0, set() , 以及 value.

◆ set2()

void eve::tensor::Tensor::set2 ( int  i0,
int  i1,
float  value 
)

在文件 Tensor.cpp230 行定义.

引用了 ensureEager(), i0, i1 , 以及 value.

◆ set3()

void eve::tensor::Tensor::set3 ( int  i0,
int  i1,
int  i2,
float  value 
)

在文件 Tensor.cpp238 行定义.

引用了 ensureEager(), i0, i1, i2 , 以及 value.

◆ set4()

void eve::tensor::Tensor::set4 ( int  i0,
int  i1,
int  i2,
int  i3,
float  value 
)

在文件 Tensor.cpp246 行定义.

引用了 ensureEager(), i0, i1, i2 , 以及 value.

◆ set5()

void eve::tensor::Tensor::set5 ( int  i0,
int  i1,
int  i2,
int  i3,
int  i4,
float  value 
)

在文件 Tensor.cpp254 行定义.

引用了 ensureEager(), i0, i1, i2 , 以及 value.

◆ set6()

void eve::tensor::Tensor::set6 ( int  i0,
int  i1,
int  i2,
int  i3,
int  i4,
int  i5,
float  value 
)

在文件 Tensor.cpp262 行定义.

引用了 ensureEager(), i0, i1, i2 , 以及 value.

◆ setDtype()

void eve::tensor::Tensor::setDtype ( DType  dtype)
inline

在文件 Tensor.h79 行定义.

引用了 dtype().

◆ sigmoid()

Tensor * eve::tensor::Tensor::sigmoid ( ) const

◆ silu()

Tensor * eve::tensor::Tensor::silu ( ) const

◆ sin()

Tensor * eve::tensor::Tensor::sin ( ) const

◆ sqrt()

Tensor * eve::tensor::Tensor::sqrt ( ) const

◆ sub()

Tensor * eve::tensor::Tensor::sub ( const Tensor other) const

在文件 Tensor.cpp320 行定义.

引用了 eve::tensor::Sub.

◆ subScalar()

Tensor * eve::tensor::Tensor::subScalar ( float  s) const

◆ tanh()

Tensor * eve::tensor::Tensor::tanh ( ) const

◆ transpose()

Tensor * eve::tensor::Tensor::transpose ( ) const

在文件 Tensor.cpp528 行定义.

引用了 dequantized(), ensureEager(), f, isQuantized(), permute() , 以及 Tensor().

友元及相关函数文档

◆ CompiledFunction

friend class CompiledFunction
friend

在文件 Tensor.h174 行定义.

◆ Func

friend class Func
friend

在文件 Tensor.h173 行定义.

◆ Graph

friend class Graph
friend

在文件 Tensor.h175 行定义.

◆ TF

friend class TF
friend

在文件 Tensor.h172 行定义.

类成员变量说明

◆ kMaxRank


该类的文档由以下文件生成: