tumourkit.classification.models.hgao.HardGAT
- class tumourkit.classification.models.hgao.HardGAT(in_dim, num_hidden, num_classes, heads, num_layers, dropout, norm_type, activation=<function elu>, negative_slope=0.2, residual=False, k=8, enable_background=False)
Bases:
ModuleMethods
add_moduleAdds a child module to the current module.
applyApplies
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16Casts all floating point parameters and buffers to
bfloat16datatype.buffersReturns an iterator over module buffers.
childrenReturns an iterator over immediate children modules.
cpuMoves all model parameters and buffers to the CPU.
cudaMoves all model parameters and buffers to the GPU.
doubleCasts all floating point parameters and buffers to
doubledatatype.evalSets the module in evaluation mode.
extra_reprSet the extra representation of the module
floatCasts all floating point parameters and buffers to
floatdatatype.Defines the computation performed at every call.
get_bufferReturns the buffer given by
targetif it exists, otherwise throws an error.get_extra_stateReturns any extra state to include in the module's state_dict.
get_parameterReturns the parameter given by
targetif it exists, otherwise throws an error.get_submoduleReturns the submodule given by
targetif it exists, otherwise throws an error.halfCasts all floating point parameters and buffers to
halfdatatype.ipuMoves all model parameters and buffers to the IPU.
load_state_dictCopies parameters and buffers from
state_dictinto this module and its descendants.modulesReturns an iterator over all modules in the network.
named_buffersReturns an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_childrenReturns an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modulesReturns an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parametersReturns an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parametersReturns an iterator over module parameters.
register_backward_hookRegisters a backward hook on the module.
register_bufferAdds a buffer to the module.
register_forward_hookRegisters a forward hook on the module.
register_forward_pre_hookRegisters a forward pre-hook on the module.
register_full_backward_hookRegisters a backward hook on the module.
register_full_backward_pre_hookRegisters a backward pre-hook on the module.
register_load_state_dict_post_hookRegisters a post hook to be run after module's
load_state_dictis called.register_moduleAlias for
add_module().register_parameterAdds a parameter to the module.
register_state_dict_pre_hookThese hooks will be called with arguments:
self,prefix, andkeep_varsbefore callingstate_dictonself.requires_grad_Change if autograd should record operations on parameters in this module.
set_extra_stateThis function is called from
load_state_dict()to handle any extra state found within the state_dict.share_memorySee
torch.Tensor.share_memory_()state_dictReturns a dictionary containing references to the whole state of the module.
toMoves and/or casts the parameters and buffers.
to_emptyMoves the parameters and buffers to the specified device without copying storage.
trainSets the module in training mode.
typeCasts all parameters and buffers to
dst_type.xpuMoves all model parameters and buffers to the XPU.
zero_gradSets gradients of all model parameters to zero.
Attributes
T_destinationcall_super_initdump_patches- forward(g, inputs)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.