torch / nngraph

Graph Computation for nn
Other
299 stars 96 forks source link

Return type of gModule when no arguments are passed to method: type(). #112

Closed rohanpadhye closed 8 years ago

rohanpadhye commented 8 years ago

As per torch/nn#691, the nn.Module interface can be queried for the module's type by calling the type() method with no arguments. This change makes nn.gModule conform to this API as well.

After initialization, this returns the default type of torch.Tensor (as self._type is initialized in nn.Module.__init). If the module's type is explicitly changed using type(<some_type>), then this is remembered and returned the next time type() is called without arguments.

soumith commented 8 years ago

Thank you!