graph_bilinear_interdependence_layer
Bases: layer
A layer that combines graph interdependence with bilinear interdependence.
This layer integrates graph_bilinear_interdependence_head
instances to simultaneously model
graph-structured data relationships and bilinear dependencies.
Attributes:
Name | Type | Description |
---|---|---|
m |
int
|
The input dimensionality of the layer. |
n |
int
|
The output dimensionality of the layer. |
width |
int
|
The number of |
name |
str
|
The name of the layer. |
channel_num |
int
|
The number of channels in each |
graph |
(graph, optional)
|
The graph structure to be used. If not provided, |
graph_file_path |
(str, optional)
|
Path to the file from which the graph can be loaded. |
nodes |
(list, optional)
|
A list of node identifiers in the graph. |
links |
(list, optional)
|
A list of edges in the graph. |
directed |
bool
|
Whether the graph is directed. |
with_multihop |
bool
|
Whether to enable multi-hop dependencies. |
h |
int
|
Number of hops for multi-hop dependencies. |
accumulative |
bool
|
Whether to accumulate dependencies across hops. |
with_pagerank |
bool
|
Whether to include PageRank-like dependencies in the layer. |
c |
float
|
Damping factor for PageRank dependencies. |
require_data |
bool
|
Whether data is required for the graph interdependence function. |
require_parameters |
bool
|
Whether parameters are required for the graph interdependence function. |
normalization |
bool
|
Whether to normalize the adjacency matrix. |
normalization_mode |
str
|
The normalization mode for the adjacency matrix ( |
self_dependence |
bool
|
Whether to include self-dependencies in the graph structure. |
with_dual_lphm_interdependence |
bool
|
Whether to use dual LPHM bilinear interdependence. |
with_lorr_interdependence |
bool
|
Whether to use LORR bilinear interdependence. |
r_interdependence |
int
|
The rank for bilinear interdependence reconciliation. |
with_dual_lphm |
bool
|
Whether to use dual LPHM reconciliation. |
with_lorr |
bool
|
Whether to use LORR reconciliation. |
r |
int
|
The rank for parameter reconciliation. |
with_residual |
bool
|
Whether to include residual connections in the layer. |
enable_bias |
bool
|
Whether to enable bias terms in parameter reconciliation. |
with_batch_norm |
bool
|
Whether to apply batch normalization to the layer's output. |
with_relu |
bool
|
Whether to apply ReLU activation to the layer's output. |
with_softmax |
bool
|
Whether to apply softmax activation to the layer's output. |
with_dropout |
bool
|
Whether to apply dropout to the layer's output. |
p |
float
|
The dropout probability. |
parameters_init_method |
str
|
The initialization method for parameters. |
device |
str
|
The device on which to run the layer ( |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the graph bilinear interdependence layer. |
Source code in tinybig/layer/graph_based_layers.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
|
__init__(m, n, width=1, name='graph_bilinear_interdependence_layer', channel_num=1, graph=None, graph_file_path=None, nodes=None, links=None, directed=False, with_multihop=False, h=1, accumulative=False, with_pagerank=False, c=0.15, require_data=False, require_parameters=False, normalization=False, normalization_mode='column', self_dependence=True, with_dual_lphm_interdependence=False, with_lorr_interdependence=False, r_interdependence=3, with_dual_lphm=False, with_lorr=False, r=3, with_residual=False, enable_bias=False, with_batch_norm=False, with_relu=True, with_softmax=True, with_dropout=True, p=0.5, parameters_init_method='xavier_normal', device='cpu', *args, **kwargs)
Initialize the Graph Bilinear Interdependence Layer.
This method creates a graph bilinear interdependence layer that combines graph-based
dependencies with bilinear interdependence functions. The layer consists of multiple
graph_bilinear_interdependence_head
instances, which are configured based on the
provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m
|
int
|
The input dimensionality of the layer. |
required |
n
|
int
|
The output dimensionality of the layer. |
required |
width
|
int
|
The number of |
1
|
name
|
str
|
The name of the layer. Default is |
'graph_bilinear_interdependence_layer'
|
channel_num
|
int
|
The number of channels in each head. Default is 1. |
1
|
graph
|
graph
|
A pre-loaded graph structure. If provided, this takes precedence over |
None
|
graph_file_path
|
str
|
Path to the file containing the graph structure. |
None
|
nodes
|
list
|
A list of node identifiers. |
None
|
links
|
list
|
A list of edges representing connections between nodes. |
None
|
directed
|
bool
|
Indicates whether the graph is directed. Default is |
False
|
with_multihop
|
bool
|
If |
False
|
h
|
int
|
The number of hops to consider for multi-hop dependencies. Default is 1. |
1
|
accumulative
|
bool
|
If |
False
|
with_pagerank
|
bool
|
If |
False
|
c
|
float
|
Damping factor for PageRank dependencies. Default is 0.15. |
0.15
|
require_data
|
bool
|
If |
False
|
require_parameters
|
bool
|
If |
False
|
normalization
|
bool
|
If |
False
|
normalization_mode
|
str
|
Specifies the normalization mode ( |
'column'
|
self_dependence
|
bool
|
If |
True
|
with_dual_lphm_interdependence
|
bool
|
If |
False
|
with_lorr_interdependence
|
bool
|
If |
False
|
r_interdependence
|
int
|
The rank for bilinear interdependence parameterization. Default is 3. |
3
|
with_dual_lphm
|
bool
|
If |
False
|
with_lorr
|
bool
|
If |
False
|
r
|
int
|
The rank used for parameter reconciliation. Default is 3. |
3
|
with_residual
|
bool
|
If |
False
|
enable_bias
|
bool
|
If |
False
|
with_batch_norm
|
bool
|
If |
False
|
with_relu
|
bool
|
If |
True
|
with_softmax
|
bool
|
If |
True
|
with_dropout
|
bool
|
If |
True
|
p
|
float
|
The dropout probability. Default is 0.5. |
0.5
|
parameters_init_method
|
str
|
Specifies the initialization method for parameters. Default is |
'xavier_normal'
|
device
|
str
|
The device on which to run the layer ( |
'cpu'
|
Raises:
Type | Description |
---|---|
ValueError
|
If a graph structure is not provided via |
Notes
- This layer supports both graph-based interdependence and bilinear interdependence, combining the two through a fusion mechanism.
- If both
graph
andgraph_file_path
are provided,graph
takes precedence.
Source code in tinybig/layer/graph_based_layers.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
|