VGAE
- class VGAE[source]
Bases:
VGAE,EmbeddingMixin- __init__(dim, hidden_dim, num_features, dist=False)[source]
initialise a Variational Graph Auto-Encoder model
- Parameters:
dim – output dimension
hidden_dim – inner hidden dimension
num_features – number of input features
dist – if
Trueuse distance decoder, otherwise use inner product decoder (default:False)
- Returns:
initialised
tg.nn.VGAEmodel
Methods
initialise a Variational Graph Auto-Encoder model
add_moduleAdd a child module to the current module.
applyApply
fnrecursively to every submodule (as returned by.children()) as well as self.bfloat16Casts all floating point parameters and buffers to
bfloat16datatype.buffersReturn an iterator over module buffers.
childrenReturn an iterator over immediate children modules.
compileCompile this Module's forward using
torch.compile().cpuMove all model parameters and buffers to the CPU.
cudaMove all model parameters and buffers to the GPU.
decodeRuns the decoder and computes edge probabilities.
doubleCasts all floating point parameters and buffers to
doubledatatype.embedCompute embedding for model and data
encodeevalSet the module in evaluation mode.
extra_reprSet the extra representation of the module.
floatCasts all floating point parameters and buffers to
floatdatatype.forwardAlias for
encode().get_bufferReturn the buffer given by
targetif it exists, otherwise throw an error.get_extra_stateReturn any extra state to include in the module's state_dict.
get_parameterReturn the parameter given by
targetif it exists, otherwise throw an error.get_submoduleReturn the submodule given by
targetif it exists, otherwise throw an error.halfCasts all floating point parameters and buffers to
halfdatatype.ipuMove all model parameters and buffers to the IPU.
kl_lossComputes the KL loss, either for the passed arguments
muandlogstd, or based on latent variables from last encoding.load_state_dictCopy parameters and buffers from
state_dictinto this module and its descendants.modulesReturn an iterator over all modules in the network.
named_buffersReturn an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself.
named_childrenReturn an iterator over immediate children modules, yielding both the name of the module as well as the module itself.
named_modulesReturn an iterator over all modules in the network, yielding both the name of the module as well as the module itself.
named_parametersReturn an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.
parametersReturn an iterator over module parameters.
recon_lossGiven latent variables
z, computes the binary cross entropy loss for positive edgespos_edge_indexand negative sampled edges.register_backward_hookRegister a backward hook on the module.
register_bufferAdd a buffer to the module.
register_forward_hookRegister a forward hook on the module.
register_forward_pre_hookRegister a forward pre-hook on the module.
register_full_backward_hookRegister a backward hook on the module.
register_full_backward_pre_hookRegister a backward pre-hook on the module.
register_load_state_dict_post_hookRegister a post hook to be run after module's
load_state_dictis called.register_moduleAlias for
add_module().register_parameterAdd a parameter to the module.
register_state_dict_pre_hookRegister a pre-hook for the
load_state_dict()method.reparametrizerequires_grad_Change if autograd should record operations on parameters in this module.
reset_parametersResets all learnable parameters of the module.
set_extra_stateSet extra state contained in the loaded state_dict.
share_memorySee
torch.Tensor.share_memory_().state_dictReturn a dictionary containing references to the whole state of the module.
testGiven latent variables
z, positive edgespos_edge_indexand negative edgesneg_edge_index, computes area under the ROC curve (AUC) and average precision (AP) scores.toMove and/or cast the parameters and buffers.
to_emptyMove the parameters and buffers to the specified device without copying storage.
trainSet the module in training mode.
typeCasts all parameters and buffers to
dst_type.xpuMove all model parameters and buffers to the XPU.
zero_gradReset gradients of all model parameters.
Attributes
T_destinationcall_super_initdump_patchestraining