openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.12k stars 2.04k forks source link

Abs value inference and optimization #24526

Closed jane-intel closed 1 week ago

jane-intel commented 2 weeks ago

Details:

PyTorch semantic of Expand operation requires Abs operation for translation which is usually a no-op.

  1. partial value and symbol propagation for Abs operation
  2. optimize out the Abs with nonnegative input
  3. for this case Abs(Concat([Gather(ShapeOf), -1, 1, -1])) pulls Abs and tries to const-fold it. Resulting in Concat([Abs(Gather(ShapeOf)), 1, 1, 1]). Applies (2) to the graph and gets Concat([Gather(ShapeOf), 1, 1, 1]) because ShapeOf's lower bound is 0.

Tickets:


UPD: Current PR unraveled the issue in pass::Manager -- here is a WA: https://github.com/openvinotoolkit/openvino/pull/24604, ticket: CVS-141764