Skip to content

Investigate unknown dimensions encoded as Const(-1) expressions #56

Description

@stevenvar

Context

During GraphProperties conversion in mark_for_compilation_pass.cc, a dimension without expression metadata is converted to a constant expression using its TensorFlow dimension size. For an unknown dimension, that produces both:

  • TensorFlow dimension size -1
  • symbolic expression Const(-1)

TensorFlow normally uses dimension size -1 as an unknown-shape sentinel. In the symbolic expression system, however, Const(-1) may be treated as a known constant value rather than an unknown dimension.

The same conversion also represents an unknown rank using the synthetic variables Var(-888) and Var(-889), which effectively assumes two symbolic dimensions even though the actual rank is unknown.

Risk

Changing this directly may affect clustering, symbolic propagation, and compatibility checks that currently rely on these fallbacks. This should therefore be investigated with focused regression tests before changing the representation.

Possible direction

  • Preserve TensorFlow dimension size -1 for unknown dimensions.
  • Use an explicit unknown expression, or no expression metadata, instead of Const(-1).
  • Represent unknown rank explicitly rather than inventing a fixed number of symbolic dimensions.
  • Check all consumers for assumptions about missing or unknown expression metadata.

This is a deferred robustness investigation; it is not currently tied to a confirmed model failure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions