Skip to content

Recover slice extents of the form x[i:i+n] as concrete dimensions #783

Description

@khatchad

A slice of the form x[start:start + n] has extent n on the sliced axis whenever n is statically known, regardless of start; the analysis currently degrades such slices to an unknown extent.

Witness chain (MusicTransformer-tensorflow2.0): data.py:85-93 conditionally reassigns the loaded event sequence through data = data[start:start + max_length], and Data.batch collects the per-file sequences and batches them via np.array(batch_data) (data.py:36), so the batched result's runtime shape is (batch_size, length) with length flowing from the driver. Recovering the slice extent (through the existing constant-folding and argument-resolution machinery for n) and composing the container's element shapes through np.array would tighten the batch shape from unknown toward (batch, n).

The dim-arithmetic classification follows #721: an n that resolves to a fixed integer yields a NumericDim; a fixed-but-unresolvable n yields UnresolvedDim; only None-evidence yields DynamicDim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions