The conditional statement (aka predicate) passed to ``cond()`` must be one of the following: - ``torch.Tensor`` with a single element - boolean expression NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized.
(x)
| 931 | # We can look at the example called ``cond_predicate``, which has a ``torch.cond`` tag. The example code looks like: |
| 932 | |
| 933 | def cond_predicate(x): |
| 934 | """ |
| 935 | The conditional statement (aka predicate) passed to ``cond()`` must be one of the following: |
| 936 | - ``torch.Tensor`` with a single element |
| 937 | - boolean expression |
| 938 | NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized. |
| 939 | """ |
| 940 | pred = x.dim() > 2 and x.shape[2] > 10 |
| 941 | return cond(pred, lambda x: x.cos(), lambda y: y.sin(), [x]) |
| 942 | |
| 943 | ###################################################################### |
| 944 | # More generally, ExportDB can be used as a reference when one of the following occurs: |
nothing calls this directly
no outgoing calls
no test coverage detected