This is an archive of the discontinued LLVM Phabricator instance.

Make it possible to create DenseElementsAttrs with arbitrary shaped types in Python bindings
ClosedPublic

Authored by apaszke on Mar 1 2023, 2:57 AM.

Details

Summary

Right now the bindings assume that all DenseElementsAttrs correspond to tensor values,
making it impossible to create vector-typed constants. I didn't want to change the API
significantly, so I opted for reusing the current signature of .get. Its type argument
now accepts both element types (in which case shape and signless can be specified too),
or a shaped type, which specifies the full type of the created attr (shape cannot be specified
in that case).

Diff Detail

Event Timeline

apaszke created this revision.Mar 1 2023, 2:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2023, 2:57 AM
apaszke requested review of this revision.Mar 1 2023, 2:57 AM

Could you add a test to show both usages/avoid regressions?

apaszke updated this revision to Diff 501552.Mar 1 2023, 9:40 AM

Added tests

ftynse accepted this revision.Mar 1 2023, 11:46 AM
This revision is now accepted and ready to land.Mar 1 2023, 11:46 AM