Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hvgae-ad
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gladis
hvgae-ad
Merge requests
!2
Master
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Master
master
into
main
Overview
0
Commits
2
Pipelines
0
Changes
71
Merged
Mohamed Yacine Touahria Miliani
requested to merge
master
into
main
8 months ago
Overview
0
Commits
2
Pipelines
0
Changes
71
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
989d2e17
2 commits,
8 months ago
71 files
+
28594
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
71
Search (e.g. *.vue) (Ctrl+P)
DOMINANT/layers.py
0 → 100644
+
45
−
0
Options
import
math
import
torch
from
torch.nn.parameter
import
Parameter
from
torch.nn.modules.module
import
Module
import
torch.nn
as
nn
import
torch.nn.functional
as
F
class
GraphConvolution
(
Module
):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def
__init__
(
self
,
in_features
,
out_features
,
bias
=
True
):
super
(
GraphConvolution
,
self
).
__init__
()
self
.
in_features
=
in_features
self
.
out_features
=
out_features
self
.
weight
=
Parameter
(
torch
.
FloatTensor
(
in_features
,
out_features
))
if
bias
:
self
.
bias
=
Parameter
(
torch
.
FloatTensor
(
out_features
))
else
:
self
.
register_parameter
(
'
bias
'
,
None
)
self
.
reset_parameters
()
def
reset_parameters
(
self
):
stdv
=
1.
/
math
.
sqrt
(
self
.
weight
.
size
(
1
))
self
.
weight
.
data
.
uniform_
(
-
stdv
,
stdv
)
if
self
.
bias
is
not
None
:
self
.
bias
.
data
.
uniform_
(
-
stdv
,
stdv
)
def
forward
(
self
,
input
,
adj
):
support
=
torch
.
mm
(
input
,
self
.
weight
)
output
=
torch
.
spmm
(
adj
,
support
)
if
self
.
bias
is
not
None
:
return
output
+
self
.
bias
else
:
return
output
def
__repr__
(
self
):
return
self
.
__class__
.
__name__
+
'
(
'
\
+
str
(
self
.
in_features
)
+
'
->
'
\
+
str
(
self
.
out_features
)
+
'
)
'
Loading