AttributeError Traceback (most recent call last) <ipython-input-11-3988a92b3615> in…
- User
AttributeError Traceback (most recent call last) in 2 in_features = 2 3 wiring = AutoNCP(16,out_features) # 16 units, 1 motor neuron ----> 4 CfC_model = CfC(in_features, wiring, batch_first=True) 5 learn = SequenceLearner(CfC_model, lr=0.01) 6 trainer = pl.Trainer(
d:\Anaconda3\envs\pytorch\lib\site-packages\ncps\torch\cfc.py in init(self, input_size, units, proj_size, return_sequences, batch_first, mixed_memory, mode, activation, backbone_units, backbone_layers, backbone_dropout) 83 input_size, 84 self.wiring_or_units, ---> 85 mode, 86 ) 87 else:
d:\Anaconda3\envs\pytorch\lib\site-packages\ncps\torch\wired_cfc_cell.py in init(self, input_size, wiring, mode) 55 sparsity_mask=input_sparsity, 56 ) ---> 57 self.register_module(f"layer_{l}", rnn_cell) 58 self._layers.append(rnn_cell) 59 in_features = len(hidden_units)
d:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py in getattr(self, name) 1176 return modules[name] 1177 raise AttributeError("'{}' object has no attribute '{}'".format( -> 1178 type(self).name, name)) 1179 1180 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:
AttributeError: 'WiredCfCCell' object has no attribute 'register_module'
- Assistant
The error you're encountering suggests that the
WiredCfCCellclass is attempting to use an undefined method or attribute calledregister_module. In PyTorch, the correct method to register submodules within atorch.nn.Moduleis calledadd_module, notregister_module.Here's a general approach to troubleshooting and fixing this issue:
-
Verify Library Version: Make sure you're using a compatible version of the
ncpslibrary alongside your version of PyTorch. It's possible that a function or API has changed or been deprecated.
-