Eliding casts

EDIT: ignore this post.

That is of limited applicability. Consider if there are two extract_element ops using the same tensor (or another random use by an operator that has the same property that extract_element does).