Skip to content

Commit

Permalink
add sample code for summary (#3571)
Browse files Browse the repository at this point in the history
  • Loading branch information
LielinJiang authored Jun 4, 2021
1 parent 497d17b commit 78d792d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/api/paddle/summary_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,17 @@ summary
# ---------------------------------------------------------------------------
# {'total_params': 61610, 'trainable_params': 61610}
# multi input demo
class LeNetMultiInput(LeNet):
def forward(self, inputs, y):
x = self.features(inputs)
if self.num_classes > 0:
x = paddle.flatten(x, 1)
x = self.fc(x + y)
return x
lenet_multi_input = LeNetMultiInput()
params_info = paddle.summary(lenet_multi_input, [(1, 1, 28, 28), (1, 400)],
['float32', 'float32'])
print(params_info)

0 comments on commit 78d792d

Please sign in to comment.