|
| 1 | +# PyTorch Operations Dynamic Shape Support Summary |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + | Operation | Test Method | Supports Dynamic Shape | Shape | Num of dimensions | Reason | |
| 6 | +| --- | --- | --- | --- | --- | --- | |
| 7 | +| adaptive_avgpool | | partially | (-1, -1, 256, 256) | 2 | AdaptiveAvgPool2d and AdaptiveAvgPool3d currently doesn't support dynamic shapes for last two dims. | |
| 8 | +| any | | no | | | torch.zeros(tuple(\[*input_t.shape\])). Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 9 | +| as_strided | | no | | | RuntimeError: setStorage: sizes \[2, 3\], strides \[1, 2\], storage offset 0, and itemsize 8 requiring a storage size of 48 are out of bounds for storage of size 16 | |
| 10 | +| avg_pool | avg_pool2d | yes | (-1,-,1,-1,-1) | 4 | | |
| 11 | +| | avg_pool1d | partially | (-1, 3, 3) | 1 | | |
| 12 | +| batchnorm | | partially | (-1, 3, -1, -1) | 3 | "Channel dim can't be dynamic for batch norm." | |
| 13 | +| binary_ops | | yes | (-1,-,1,-1,-1) | 4 | | |
| 14 | +| cat | | yes | (-1,-,1,-1,-1) | 4 | | |
| 15 | +| chunk | | partially | (-1, 1, 3, -1) | any (not chunk dim) | AssertionError: Can't chunk on dynamic shape dimension! | |
| 16 | +| clamp | | yes | (-1,-,1,-1,-1) | | | |
| 17 | +| convolution | conv2d | partially | (-1, 3, -1, -1) | 3 | AssertionError: Channel dim can't be dynamic for convolution. | |
| 18 | +| | conv1d | partially | (-1, 3, 3) | 1 | | |
| 19 | +| | conv3d | partially | (-1,-,1,-1,-1) | 4 | AssertionError: Channel dim can't be dynamic for convolution. | |
| 20 | +| dequantize | | yes | (-1,-,1,-1,-1) | 4 | | |
| 21 | +| eimsum | | yes | (-1,-,1,-1,-1) | 4 | | |
| 22 | +| elu | | yes | (-1,-,1,-1,-1) | 4 | | |
| 23 | +| embedding | | yes | (-1,-,1,-1,-1) | 4 | | |
| 24 | +| eq | SimpleConverter | yes | (-1,-,1,-1,-1) | 4 | | |
| 25 | +| | ConstInputConverter | yes | (-1,-,1,-1,-1) | 4 | | |
| 26 | +| | EqMethodConverter | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 27 | +| | EqOperatorConverter | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 28 | +| | EqOperatorConstant | partially | (3,-1) | 1 | | |
| 29 | +| | EqConverter | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 30 | +| expand | | no | | | Dynamic shape is not suitable for the expand operation. | |
| 31 | +| flatten | | yes | (-1, -1, -1, -1, -1) | 5 | | |
| 32 | +| gelu | | yes | (-1,-,1,-1,-1) | 4 | | |
| 33 | +| getitem | | yes | (-1,-,1,-1,-1) | 4 | | |
| 34 | +| gt | EqOperatorSimpleConverter | yes | (-1,-,1,-1,-1) | 4 | | |
| 35 | +| | ConstInputConverter | yes | (-1,-,1,-1,-1) | 4 | | |
| 36 | +| | GtConverter | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 37 | +| | GtMethodConverter | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 38 | +| | GtOperator | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 39 | +| | EqOperator | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 40 | +| hardsigmoid | | yes | (-1,-,1,-1,-1) | 4 | | |
| 41 | +| hardtanh | | yes | (-1,-,1,-1,-1) | 4 | | |
| 42 | +| interpolate | | yes | (-1,-,1,-1,-1) | 4 | | |
| 43 | +| isinf | | yes | (-1,-,1,-1,-1) | 4 | | |
| 44 | +| leaky_relu | | yes | (-1,-,1,-1,-1) | 4 | | |
| 45 | +| linear | | partially | (-1, 3, 5) | 1 | AssertionError: Currently we only support one dynmaic dim for linear and it can't be the last dim. | |
| 46 | +| logical_and | | yes | (-1, -1, -1, -1) | 4 | | |
| 47 | +| logical_or | | yes | (-1, -1, -1, -1) | 4 | | |
| 48 | +| logical_xor | | yes | (-1, -1, -1, -1) | 4 | | |
| 49 | +| lt | | yes | (-1, -1, -1, -1) | 4 | | |
| 50 | +| masked_fill | | no | limitation in converter | | RuntimeError: Trying to create tensor with negative dimension -1: \[-1, -1, -1, -1\] | |
| 51 | +| mat_mul | | yes | batch dim | | | |
| 52 | +| max | MaxFullReduce | yes | (-1, -1, -1, -1) | 4 | | |
| 53 | +| | MaxDimReduce | yes | (-1, -1, -1, -1) | 4 | | |
| 54 | +| | MaxMethod | yes | (-1, -1, -1, -1) | 4 | | |
| 55 | +| maximum | | yes | (-1, -1, -1, -1) | 4 | | |
| 56 | +| maxpool | max_pool1d | partially | (1, 1, -1) | 1 | shape is not set to (-1, -1, -1) as reshape dimension with, more than one -1 wildcard is not allowed while adding unsqueeze layer | |
| 57 | +| | max_pool2d | yes | (-1, -1, -1, -1) | 4 | | |
| 58 | +| | max_pool3d | yes | (-1, -1, -1, -1, -1) | 5 | | |
| 59 | +| min | MinFullReduce | yes | (-1, -1, -1, -1) | 4 | | |
| 60 | +| | MinDimReduce | yes | (-1, -1, -1, -1) | 4 | | |
| 61 | +| | MinMethod | yes | (-1, -1, -1, -1) | 4 | | |
| 62 | +| minimum | | yes | (-1, -1, -1, -1) | 4 | | |
| 63 | +| narrow | | partially | (-1, 3, -1, -1) | 3 | AssertionError: Can't chunk on dynamic shape dimension! | |
| 64 | +| ne | NeFunctionConverter | yes | (-1, -1, -1, -1) | 4 | | |
| 65 | +| | NeMethodConverter | yes | (-1, -1, -1, -1) | 4 | | |
| 66 | +| | NeOperatorConverter | yes | (-1, -1, -1, -1) | 4 | | |
| 67 | +| | ConstInputConverter | yes | (-1, -1, -1, -1) | 4 | | |
| 68 | +| | NeOperatorConstantConverter | partially | (3, -1) | 1 | | |
| 69 | +| new_ones | | yes | (-1, -1, -1, -1) | 4 | | |
| 70 | +| numel | | no | limitation in converter | | RuntimeError: numel does not support dynamic shapes. | |
| 71 | +| pad | | no | limitation in converter | | test\_pad\_with\_dynamic\_shape\_four\_dimensions\_0\_2d (deeplearning.trt.torch\_tensorrt.py.torch\_tensorrt.fx.test.converters.acc\_op.test\_pad.TestPadConverter) ... \[07/15/2022-09:23:18\] \[TRT\] \[E\] 2: \[intInterval.cpp::max::26\] Error Code 2: Internal Error (Assertion !empty() failed. | |
| 72 | +| permute | | yes | (-1, -1, -1, -1) | 4 | | |
| 73 | +| prod | | yes | (-1, -1, -1, -1) | 4 | | |
| 74 | +| quantize\_per\_tensor | | yes | (-1, -1, -1, -1) | 4 | | |
| 75 | +| reduce op | | yes | (-1, -1, -1, -1) | 4 | | |
| 76 | +| relu | | yes | (-1, -1, -1, -1) | 4 | | |
| 77 | +| repeat interleave | | partially | (-1, 3, 2) | 1 | AssertionError: Currently we don't support unsqueeze with more than one dynamic dims. | |
| 78 | +| reshape | | yes | (-1, -1, -1, -1) | 4 | | |
| 79 | +| selu | | yes | (-1, -1, -1, -1) | 4 | | |
| 80 | +| sigmoid | | yes | (-1,-,1,-1,-1) | 4 | | |
| 81 | +| silu | | yes | (-1,-,1,-1,-1) | 4 | | |
| 82 | +| size | | yes | (-1, -1, -1, -1) | 4 | | |
| 83 | +| softmax | | yes | (-1, -1, -1, -1) | 4 | | |
| 84 | +| softsign | | yes | (-1, -1, -1, -1) | 4 | | |
| 85 | +| split | | partially | (-1, 10, -1) | 2 | AssertionError: Can't chunk on dynamic shape dimension! | |
| 86 | +| squeeze | | partially | (1, -1, 2) | 1 | AssertionError: Currently more than one dynamic dim for input to squeeze is not supported. | |
| 87 | +| std | | yes | (-1, -1, -1, -1) | 4 | | |
| 88 | +| tanh | | yes | (-1, -1, -1, -1) | 4 | | |
| 89 | +| tile | | yes | (-1, -1, -1, -1) | 4 | | |
| 90 | +| to_dtype | int | yes | (-1, -1, -1, -1) | 4 | | |
| 91 | +| | float | yes | (-1, -1, -1, -1) | 4 | | |
| 92 | +| topk | | yes | (-1, -1, -1, -1) | 4 | | |
| 93 | +| transpose_convolution | conv_transpose2d | partially | (-1, 3, -1, -1) | 3 | | |
| 94 | +| | conv_transpose3d | partially | (-1, 3, -1, -1, -1) | 4 | | |
| 95 | +| type_as | | yes | (-1, -1, -1, -1) | 4 | RuntimeError: ShapeProp error for: node=%type\_1 : \[#users=1\] = call\_method\[target=type\](args = (%input_1,), kwargs = {dtype: torch.float32}) with meta={} | |
| 96 | +| unary ops | | yes | (-1, -1, -1, -1) | 4 | | |
| 97 | +| unsqueeze | | partially | (-1, 2, 3) | 1 | AssertionError: Currently we don't support unsqueeze with more than one dynamic dims. | |
| 98 | +| where | | no | limitation in converter | | torch.broadcast_shape can not handle -1 dimension in shape \[-1, 2, 2\] | |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +Binary Ops Include following operations: |
| 103 | +|Binary Ops | |
| 104 | +|----------| |
| 105 | +|add | |
| 106 | +|sub | |
| 107 | +|div | |
| 108 | +|mul | |
| 109 | +|floor_div | |
| 110 | +|fmod | |
| 111 | +|floor_divide| |
| 112 | +|pow | |
| 113 | + |
| 114 | + |
| 115 | +Unary Ops Include following operations: |
| 116 | +|Unary Ops | |
| 117 | +|----------| |
| 118 | +|rsqrt | |
| 119 | +|sin | |
| 120 | +|cos | |
| 121 | +|tan | |
| 122 | +|sinh | |
| 123 | +|cosh | |
| 124 | +|asin | |
| 125 | +|acos | |
| 126 | +|atan | |
| 127 | +|abs | |
| 128 | +|neg | |
| 129 | +|reciprocal| |
| 130 | +|sqrt | |
| 131 | +|log | |
| 132 | +|exp | |
| 133 | +|floor | |
| 134 | +|ceil | |
| 135 | +|sign | |
| 136 | + |
| 137 | +Note: For more information about the test method, please refer to the operation test files. Additionally, test files include information about errors encountered during dynamic shape testing. |
0 commit comments