@@ -96,14 +96,14 @@ class Sequential(Module): | |||||
index = _valid_index(len(self), index, self.__class__.__name__) | index = _valid_index(len(self), index, self.__class__.__name__) | ||||
return list(self._cells.values())[index] | return list(self._cells.values())[index] | ||||
def __setitem__(self, index, cell): | |||||
def __setitem__(self, index, module): | |||||
cls_name = self.__class__.__name__ | cls_name = self.__class__.__name__ | ||||
if _valid_cell(cell, cls_name): | |||||
if _valid_cell(module, cls_name): | |||||
prefix, _ = _get_prefix_and_index(self._cells) | prefix, _ = _get_prefix_and_index(self._cells) | ||||
index = _valid_index(len(self), index, cls_name) | index = _valid_index(len(self), index, cls_name) | ||||
key = list(self._cells.keys())[index] | key = list(self._cells.keys())[index] | ||||
self._cells[key] = cell | |||||
cell.update_parameters_name(prefix + key + ".") | |||||
self._cells[key] = module | |||||
module.update_parameters_name(prefix + key + ".") | |||||
self.cell_list = list(self._cells.values()) | self.cell_list = list(self._cells.values()) | ||||
def __delitem__(self, index): | def __delitem__(self, index): | ||||
@@ -142,12 +142,12 @@ class Sequential(Module): | |||||
for cell in self._cells.values(): | for cell in self._cells.values(): | ||||
cell.set_grad(flag) | cell.set_grad(flag) | ||||
def append(self, cell): | |||||
def append(self, module): | |||||
""" | """ | ||||
Appends a given Module to the end of the list. | Appends a given Module to the end of the list. | ||||
Args: | Args: | ||||
cell(Module): The Module to be appended. | |||||
module(Module): The Module to be appended. | |||||
Examples: | Examples: | ||||
>>> conv = nn.Conv2d(3, 2, 3, pad_mode='valid', weight_init="ones") | >>> conv = nn.Conv2d(3, 2, 3, pad_mode='valid', weight_init="ones") | ||||
@@ -163,11 +163,11 @@ class Sequential(Module): | |||||
[[26.999863 26.999863] | [[26.999863 26.999863] | ||||
[26.999863 26.999863]]]] | [26.999863 26.999863]]]] | ||||
""" | """ | ||||
if _valid_cell(cell, self.__class__.__name__): | |||||
if _valid_cell(module, self.__class__.__name__): | |||||
prefix, _ = _get_prefix_and_index(self._cells) | prefix, _ = _get_prefix_and_index(self._cells) | ||||
cell.update_parameters_name(prefix + str(len(self)) + ".") | |||||
module.update_parameters_name(prefix + str(len(self)) + ".") | |||||
self._is_dynamic_name.append(True) | self._is_dynamic_name.append(True) | ||||
self._cells[str(len(self))] = cell | |||||
self._cells[str(len(self))] = module | |||||
self.cell_list = list(self._cells.values()) | self.cell_list = list(self._cells.values()) | ||||
def add_module(self, name, module): | def add_module(self, name, module): | ||||
@@ -350,7 +350,7 @@ class ModuleList(_ModuleListBase, Module): | |||||
Appends a given Module to the end of the list. | Appends a given Module to the end of the list. | ||||
Args: | Args: | ||||
cell(Module): The subcell to be appended. | |||||
module(Module): The subcell to be appended. | |||||
""" | """ | ||||
if _valid_cell(module, self.__class__.__name__): | if _valid_cell(module, self.__class__.__name__): | ||||
if self._auto_prefix: | if self._auto_prefix: | ||||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》