타입¶
타입¶
Legato eDSL에서 텐서와 scalar에 어노테이션을 붙일 때 쓰는 타입 생성자입니다.
텐서를 특정 compute model의 메모리 공간에 binding할 때는 다음 예처럼 활성 compute model이 제공하는 모델 전용 생성자를 쓰십시오.
1 | |
tensor¶
1 | |
Create a tensor type.
Creates a Legato tensor type of the given type and shape.
Parameters:
dtype(Value): Interpreted type of the tensor.shape(Value): Interpreted shape of the tensor. (List of constexpr Integer, or Index)memory(Value | None): Interpreted memory of the tensor. (Memory type) Default:None.layout(Value | None): Interpreted layout of the tensor. (Layout type) Default:None.
Returns:
- (
Callable): Constexpr value representing the tensor type.
float¶
1 | |
Create a floating-point type.
Creates a Legato floating-point scalar type of the given kind.
Parameters:
kind(Value): Interpreted string specifying the float kind. Supported kinds include: "float16" ("half"), "float32" ("float"), "float64" ("double"), "float8", "float4", "bfloat16".
Returns:
- (
Callable): Constexpr value representing the floating-point type.
Example:
1 2 3 | |
integer¶
1 | |
Create an integer type.
Creates a Legato integer scalar type of the given kind.
Parameters:
kind(Value): Interpreted string specifying the integer kind. Supported kinds include: "bool", "int4", "int8", "int16", "int32", "int64".
Returns:
- (
Callable): Constexpr value representing the integer type.
Example:
1 2 3 4 | |
bool¶
1 | |
Create a bool type.
Returns the Legato boolean scalar type.
Returns:
- (
Callable): Constexpr value representing the boolean type.
Example:
1 | |
index¶
1 | |
Create an index type.
Returns the Legato index scalar type, commonly used for loop indices and shapes.
Returns:
- (
Callable): Constexpr value representing the index type.
Example:
1 | |
tuple¶
1 | |
Create a tuple type.
Creates a Legato tuple type of the given types.
Parameters:
types(Value): List of constexpr values representing the types of the tuple.
Returns:
- (
Callable): Constexpr value representing the tuple type.
list¶
1 | |
Create a list type.
Creates a Legato list type of the given type.
Parameters:
list_dtype(Value): Constexpr value representing the type of the list.
Returns:
- (
Callable): Constexpr value representing the list type.
constexpr¶
1 | |
Create a constexpr type.
Marks value assigned with this type will be marked as constexpr.
Parameters:
input_type(Value): Constexpr value representing the type of the constexpr.
Returns:
- (
Callable): Constexpr value representing the constexpr type.
Note :
constexpr marker itself is not a part of the type, but kind of metadata attached to a value inside the type, that indicates whether value is constant. In other words, constexpr is property of the value, not the type.
Example :
1 2 3 | |