Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch between specification and testdata for tensor literals #2542

Open
jtristan opened this issue Sep 13, 2024 · 0 comments
Open

Mismatch between specification and testdata for tensor literals #2542

jtristan opened this issue Sep 13, 2024 · 0 comments

Comments

@jtristan
Copy link

What happened?

Many programs in testdata declare tensor literals with a syntax of the form dense<"0x29C0C7404">, which is not mentioned in the specification. Example.

The actual syntax seems to be something like:

TensorLiteral  ::= 'dense' '<' (DenseLiteral | ElementLiteral | CompactHexaStringLiteral) '>'
CompactHexaStringLiteral ::= '"' '0x' HexadecimalDigits '"'

but I am inferring this from testdata programs and I would like to know if this is indeed general enough or if I am missing other patterns that are not present in testdata.

While I mention the TensorConstant grammar, note that the current grammar

TensorConstant ::= TensorLiteral ':' TensorType
TensorLiteral  ::= 'dense' '<' (DenseLiteral | ElementLiteral) '>'
DenseLiteral   ::= DenseDimension | DenseElements
DenseDimension ::= '[' [DenseLiteral {',' DenseLiteral}] ']'
DenseElements  ::= [ElementLiteral {',' ElementLiteral}]
ElementLiteral ::= BooleanLiteral | IntegerLiteral | FloatLiteral | ComplexLiteral

allows to derive a term like dense <3.2> in two ways:
TensorLiteral -> ElementLiteral -> FloatLiteral
or TensorLiteral -> DenseLiteral -> DenseElements -> ElementLiteral -> FloatLiteral

and could be simplified to:

TensorConstant ::= TensorLiteral ':' TensorType
TensorLiteral  ::= 'dense' '<' DenseLiteral '>'
DenseLiteral   ::= DenseDimension | DenseElements
DenseDimension ::= '[' [DenseLiteral {',' DenseLiteral}] ']'
DenseElements  ::= [ElementLiteral {',' ElementLiteral}]
ElementLiteral ::= BooleanLiteral | IntegerLiteral | FloatLiteral | ComplexLiteral

Steps to reproduce your issue

No response

Version information

73b0862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant