[RFC] Relay IR Text Format
See original GitHub issueKeyword Proposal
The final keywords are:
def
for global function definitionsfn
for local function definitions/anonymous functionsif
andelse
for if-else expressionslet
for let bindingsTrue
andFalse
for booleans- data types are tvm-style. e.g.
float32x4
Loose Ends
There are some elements of the text format that didn’t make it into this PR. See #1935 for details.
Please comment on syntax design choices for #1781 here!
Notable Syntax Examples
Functions
Named, Typed
def @foo(%x: int64, %y: int64) -> int64 {
%x + %y
}
Named, Inferred
def @foo(%x, %y) {
%x + %y
}
Anonymous, Typed
fn (%x: int64, %y: int64) -> int64 {
%x + %y
}
Anonymous, Inferred
fn (%x, %y) {
%x + %y
}
Let Expressions and Mutation
Immutable
let %x = 2;
let %x = 3;
let %y = 4;
%x + %y
Side Effects Only
The following are equivalent
print("hello");
1
let %_ = print("hello");
1
Tuples
()
(0,)
(0, 1)
Types
Base Types
Designed to look like NumPy types.
int32
uint32
float32
bool
int32x4
...
Shape Types
unimplemented
s
(n + 1, 2 * n, 4)
Tensor Annotations
generics unimplemented
def @add(t1: Tensor[s, bt], t2: Tensor[s, bt]) -> Tensor[s, bt] {
...
}
Function Types
fn (int32, int32) -> int32
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:28 (28 by maintainers)
Top Results From Across the Web
[RFC] Relay IR Text Format · Issue #1782 · apache/tvm
True and False for booleans; data types are tvm-style. e.g. float32x4. Loose Ends. There are some elements of the text format that didn't...
Read more >X.400 Use of Extended Character Sets RFC 1502
RFC stream, Internet Engineering Task Force (IETF). Formats. txt html pdf ... 11 parts of ISO 8859, plus a "supplementary" set, registered as...
Read more >[IR] Unified TVM IR Infra - pre-RFC
This RFC proposes a unified IR infrastructure for the TVM stack by ... script similar to the meta support in the current relay...
Read more >rfc7208.txt
The SPF record is expressed as a single string of text found in the RDATA of a ... The record format and the...
Read more >RFCs 2300 - 2399 Index
RFCs 2300 - 2399s ; Authors: B. Kaliski. ; Date: March 1998 ; Formats: txt html json pdf ; Status: INFORMATIONAL ; DOI:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This idea just come out of my head: can we pin a version number to every relay source/serialized code? It help to switch from one version to another version.
I think using Python conventions for booleans and dtypes is probably the way to go.