mirror of
https://github.com/PaddlePaddle/PaddleClas.git
synced 2025-06-03 21:55:06 +08:00
Fix some minor bugs to adapt to paddle2.0rc. (#431)
* Update mobilenet_v3.py * Update densenet.py * Update resnest.py * Update hrnet.py * Update vgg.py * Update xception.py
This commit is contained in:
parent
6796bca110
commit
68be3ab288
@ -278,7 +278,7 @@ class DenseNet(nn.Layer):
|
|||||||
|
|
||||||
conv = self.batch_norm(conv)
|
conv = self.batch_norm(conv)
|
||||||
y = self.pool2d_avg(conv)
|
y = self.pool2d_avg(conv)
|
||||||
y = paddle.reshape(y, shape=[0, -1])
|
y = paddle.reshape(y, shape=[-1, y.shape[1]])
|
||||||
y = self.out(y)
|
y = self.out(y)
|
||||||
return y
|
return y
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ class HRNet(nn.Layer):
|
|||||||
|
|
||||||
y = self.conv_last(y)
|
y = self.conv_last(y)
|
||||||
y = self.pool2d_avg(y)
|
y = self.pool2d_avg(y)
|
||||||
y = paddle.reshape(y, shape=[0, -1])
|
y = paddle.reshape(y, shape=[-1, y.shape[1]])
|
||||||
y = self.out(y)
|
y = self.out(y)
|
||||||
return y
|
return y
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class SEModule(nn.Layer):
|
|||||||
outputs = F.relu(outputs)
|
outputs = F.relu(outputs)
|
||||||
outputs = self.conv2(outputs)
|
outputs = self.conv2(outputs)
|
||||||
outputs = hard_sigmoid(outputs)
|
outputs = hard_sigmoid(outputs)
|
||||||
return paddle.multiply(x=inputs, y=outputs, axis=0)
|
return paddle.multiply(x=inputs, y=outputs)
|
||||||
|
|
||||||
|
|
||||||
def MobileNetV3_small_x0_35(**args):
|
def MobileNetV3_small_x0_35(**args):
|
||||||
|
@ -85,11 +85,11 @@ class rSoftmax(nn.Layer):
|
|||||||
x = paddle.reshape(
|
x = paddle.reshape(
|
||||||
x=x,
|
x=x,
|
||||||
shape=[
|
shape=[
|
||||||
0, cardinality, radix, int(r * h * w / cardinality / radix)
|
batch, cardinality, radix, int(r * h * w / cardinality / radix)
|
||||||
])
|
])
|
||||||
x = paddle.transpose(x=x, perm=[0, 2, 1, 3])
|
x = paddle.transpose(x=x, perm=[0, 2, 1, 3])
|
||||||
x = nn.functional.softmax(x, axis=1)
|
x = nn.functional.softmax(x, axis=1)
|
||||||
x = paddle.reshape(x=x, shape=[0, r * h * w])
|
x = paddle.reshape(x=x, shape=[batch, r * h * w])
|
||||||
else:
|
else:
|
||||||
x = nn.functional.sigmoid(x)
|
x = nn.functional.sigmoid(x)
|
||||||
return x
|
return x
|
||||||
|
@ -113,7 +113,7 @@ class VGGNet(nn.Layer):
|
|||||||
x = self._conv_block_4(x)
|
x = self._conv_block_4(x)
|
||||||
x = self._conv_block_5(x)
|
x = self._conv_block_5(x)
|
||||||
|
|
||||||
x = paddle.reshape(x, [0, -1])
|
x = paddle.reshape(x, [-1, x.shape[1]*x.shape[2]*x.shape[3]])
|
||||||
x = self._fc1(x)
|
x = self._fc1(x)
|
||||||
x = F.relu(x)
|
x = F.relu(x)
|
||||||
x = self._drop(x)
|
x = self._drop(x)
|
||||||
|
@ -305,7 +305,7 @@ class ExitFlow(nn.Layer):
|
|||||||
conv2 = self._conv_2(conv1)
|
conv2 = self._conv_2(conv1)
|
||||||
conv2 = F.relu(conv2)
|
conv2 = F.relu(conv2)
|
||||||
pool = self._pool(conv2)
|
pool = self._pool(conv2)
|
||||||
pool = paddle.reshape(pool, [0, -1])
|
pool = paddle.reshape(pool, [-1, pool.shape[1]])
|
||||||
out = self._out(pool)
|
out = self._out(pool)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user