identity_interdependence
Bases: constant_interdependence
A class for identity interdependence.
This class defines an identity interdependence matrix, preserving the input dimensions.
Notes
Formally, based on the (optional) input data batch \(\mathbf{X} \in {R}^{b \times m}\), we define the one interdependence function as: $$ \begin{equation} \xi(\mathbf{X}) = \mathbf{I} \in {R}^{m \times m}, \text{ or } \xi(\mathbf{X}) = \mathbf{I} \in {R}^{b \times b}, \end{equation} $$ where \(\mathbf{I}\) denotes the identity interdependence matrix.
Methods:
Name | Description |
---|---|
__init__ |
Initializes the identity interdependence function. |
Source code in tinybig/interdependence/basic_interdependence.py
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 |
|
__init__(b, m, b_prime=None, m_prime=None, name='identity_interdependence', interdependence_type='attribute', device='cpu', *args, **kwargs)
Initializes the identity interdependence function.
This class sets the interdependence matrix to be an identity matrix, preserving the dimensions and structure of the input tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
b
|
int
|
Number of rows in the input tensor. |
required |
m
|
int
|
Number of columns in the input tensor. |
required |
b_prime
|
int
|
Number of rows in the output tensor for row-based interdependence. Defaults to |
None
|
m_prime
|
int
|
Number of columns in the output tensor for column-based interdependence. Defaults to |
None
|
name
|
str
|
Name of the interdependence function. Defaults to 'identity_interdependence'. |
'identity_interdependence'
|
interdependence_type
|
str
|
Type of interdependence ('attribute', 'instance', etc.). Defaults to 'attribute'. |
'attribute'
|
device
|
str
|
Device for computation. Defaults to 'cpu'. |
'cpu'
|
*args
|
tuple
|
Additional positional arguments for the parent |
()
|
**kwargs
|
dict
|
Additional keyword arguments for the parent |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If the interdependence type is not supported. |
Warning
|
If |