xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/passes/clear_undefinedness.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <ATen/ATen.h>
4 #include <ATen/core/ivalue.h>
5 #include <ATen/core/jit_type.h>
6 #include <torch/csrc/Export.h>
7 #include <torch/csrc/jit/ir/ir.h>
8 
9 namespace torch::jit {
10 
11 // Undefinedness makes argument matching fail for regular tensor operations
12 // if 1+ arguments are undefined or possibly undefined tensors.
13 // Technically, undefined tensors are **not** tensors as the regular tensor
14 // operations do not know how to handle them.
15 // However, in practice, there are guards and conversion operators that
16 // **always** gate regular operations if undefined tensors may be present
17 // Eventually, we would love to move to the world where we use optionals
18 // in lieu of undefined tensors.
19 // When this happens, this pass will be removed
20 TORCH_API void ClearUndefinedness(const std::shared_ptr<Graph>& graph);
21 
22 } // namespace torch::jit
23