This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Expose type and element count-related APIs on TensorSpec
ClosedPublic

Authored by mtrofin on Aug 4 2020, 3:02 PM.

Details

Summary

Added a mechanism to check the element type, get the total element
count, and the size of an element.

Diff Detail

Event Timeline

mtrofin created this revision.Aug 4 2020, 3:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2020, 3:02 PM
mtrofin requested review of this revision.Aug 4 2020, 3:02 PM

What is the use case of the new APIs?

What is the use case of the new APIs?

They are a small but necessary part of a change that allows us to import a specification of additional outputs that the model can produce and then need to be captured in the training log. This enables "final reward" training algorithms. Since they are relatively "general goodness", I didn't add that context here.

ebrevdo accepted this revision.Aug 4 2020, 4:00 PM
This revision is now accepted and ready to land.Aug 4 2020, 4:00 PM

lgtm (as Eugene pointed out -- use std::accumulate instead ).

mtrofin updated this revision to Diff 283073.Aug 4 2020, 5:32 PM

using accumulate

This revision was landed with ongoing or failed builds.Aug 4 2020, 5:32 PM
This revision was automatically updated to reflect the committed changes.