pytorch
21d203b5 - Add internal assert for tangent layout mismatch for view ops (#66293)

Commit
4 years ago
Add internal assert for tangent layout mismatch for view ops (#66293) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66293 This PR: - Asserts that if the output is a view, then the `is_same_metadata` must return `true`. Otherwise, we are performing a copy. - unless we are being called from `make_dual` which can allow the tangent and primal to have different layouts, because it is not forward differentiable. - To make this possible, we add `is_make_dual` as a parameter. ~The alternative is to make `make_dual` non-composite, and then we can rely on its `view_info` for differentiability information. This also assumes that the only composite function that calls `set_fw_grad` is `make_dual`.~ - Batching rules now preserve storage offset for view operator that return non-zero storage offset Test Plan: Imported from OSS Reviewed By: zou3519, albanD Differential Revision: D31842021 Pulled By: soulitzer fbshipit-source-id: ed606f5a7b4770df1e9ebc6eb1d584b27dad5bae
Author
Parents
Loading