From 7df00a6b5c09edcfd1ef75822b17c9950983888c Mon Sep 17 00:00:00 2001 From: wuzewu Date: Tue, 13 Jul 2021 20:49:47 +0800 Subject: [PATCH] Fix SETR export bug --- paddleseg/models/backbones/vision_transformer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddleseg/models/backbones/vision_transformer.py b/paddleseg/models/backbones/vision_transformer.py index d9aa79fa98..57741898aa 100644 --- a/paddleseg/models/backbones/vision_transformer.py +++ b/paddleseg/models/backbones/vision_transformer.py @@ -103,7 +103,8 @@ def __init__(self, self.proj_drop = nn.Dropout(proj_drop) def forward(self, x): - N, C = x.shape[1:] + x_shape = paddle.shape(x) + N, C = x_shape[1], x_shape[2] qkv = self.qkv(x).reshape((-1, N, 3, self.num_heads, C // self.num_heads)).transpose((2, 0, 3, 1, 4))