Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Speed up group executor #16069

Merged
merged 3 commits into from
Sep 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions python/mxnet/module/executor_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ def __init__(self, symbol, contexts, workload, data_shapes, label_shapes, param_
self.data_layouts = None
self.label_layouts = None
self.output_names = self.symbol.list_outputs()
self.output_layouts = [DataDesc.get_batch_axis(self.symbol[name].attr('__layout__'))
for name in self.output_names]
self.num_outputs = len(self.symbol.list_outputs())
self.num_outputs = len(self.output_names)
self.output_layouts = [i for i in range(self.num_outputs)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!
The following code may be faster : )

        self.num_outputs = len(self.output_names)
        self.output_layouts = [DataDesc.get_batch_axis(self.symbol[index].attr('__layout__'))
                               for index in range(self.num_outputs)]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

for index, name in enumerate(self.output_names):
self.output_layouts[index] = DataDesc.get_batch_axis(self.symbol[index].attr('__layout__'))

self.bind_exec(data_shapes, label_shapes, shared_group)

Expand Down