generated from kyegomez/Python-Package-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Feb 1, 2024
1 parent
27f5bcc
commit b99d578
Showing
3 changed files
with
37 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import torch | ||
from qformer import QFormer | ||
|
||
x = torch.randn( | ||
1, 32, 512 | ||
) # Create a random tensor of shape (1, 32, 512) | ||
# Create a random tensor of shape (1, 32, 512) | ||
x = torch.randn(1, 32, 512) | ||
|
||
# Create a random image tensor of shape (1, 3, 224, 224) | ||
img = torch.randn(1, 3, 224, 224) | ||
|
||
img = torch.randn( | ||
1, 3, 224, 224 | ||
) | ||
# Create an instance of the QFormer model with the following parameters: | ||
# - input_size: 512 | ||
# - num_heads: 8 | ||
# - num_layers: 8 | ||
# - dropout: 0.1 | ||
# - num_classes: 2 | ||
# - num_patches: 2 | ||
qformer = QFormer(512, 8, 8, 0.1, 2, 2) | ||
|
||
# Apply the QFormer model to the input tensors x and img | ||
y = qformer(x, img) | ||
|
||
qformer = QFormer( | ||
512, 8, 8, 0.1, 2, 2 | ||
) # Create an instance of the QFormer model | ||
|
||
y = qformer( | ||
x, img | ||
) # Apply the QFormer model to the input tensors x and img | ||
|
||
print(y.shape) # Print the shape of the output tensor y | ||
# Print the shape of the output tensor y | ||
print(y.shape) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters