diff --git a/python/paddle/fluid/dygraph/container.py b/python/paddle/fluid/dygraph/container.py index 2938516e5bc442c6936d79ee7ccd9b66440afa15..ca40781a5f9c48b47b72fadc4efb56c70cf779b5 100644 --- a/python/paddle/fluid/dygraph/container.py +++ b/python/paddle/fluid/dygraph/container.py @@ -79,7 +79,7 @@ class Sequential(Layer): name += len(self._sub_layers) elif name < -len(self._sub_layers): raise IndexError('index {} is out of range'.format(name)) - return self._sub_layers[str(name)] + return list(self._sub_layers.values())[name] def __setitem__(self, name, layer): assert isinstance(layer, Layer)