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.
As per torch/nn#691, the
nn.Module
interface can be queried for the module's type by calling thetype()
method with no arguments. This change makesnn.gModule
conform to this API as well.After initialization, this returns the default type of
torch.Tensor
(asself._type
is initialized innn.Module.__init
). If the module's type is explicitly changed usingtype(<some_type>)
, then this is remembered and returned the next timetype()
is called without arguments.