<jupyter_start><jupyter_text>Testing Notebook<jupyter_code># test View
import torch
from torch import nn
# Torch uses NCHW

image_tensor = torch.randn(64, 3, 200, 200)

# define some layers
# In channel, out channel, kernel, stride
conv2d_depth = nn.Conv2d(3, 3*10, 3, 1, 1)
image_tensor.size()<jupyter_output><empty_output><jupyter_text>depthwise conv increases the num channels<jupyter_code>conv2d_depth(image_tensor).size()
conv2d_2 = nn.Conv2d(3, 3*10, 7, 1, 1)<jupyter_output><empty_output><jupyter_text>due to the kernel / stride and padding the image dimensions can change<jupyter_code>conv2d_2(image_tensor).size()
# Testing the view function
image_tensor.view(image_tensor.size(0), -1).size()
# Quick Resnet print
import torchvision.models as models
resnet18 = models.resnet18()
print(resnet18)
import torch
import torchvision
import torchprof

model = torchvision.models.alexnet(pretrained=False).cuda()
x = torch.rand([1, 3, 224, 224]).cuda()

with torchprof.Profile(model, use_cuda=True) as prof:
    model(x)

print(prof.display(show_events=False)) # equivalent to `print(prof)` and `print(prof.display())`<jupyter_output>Module         | Self CPU total | CPU total | CUDA total | Occurrences
---------------|----------------|-----------|------------|------------
AlexNet        |                |           |            |            
├── features   |                |           |            |            
│├── 0         |      359.165ms |    1.437s |     1.437s |           1
│├── 1         |      959.043us |   1.714ms |    1.875ms |           1
│├── 2         |      231.398us | 504.635us |  574.112us |           1
│├── 3         |      785.574us |   3.403ms |    3.620ms |           1
│├── 4         |       80.059us |  99.289us |  100.064us |           1
│├── 5         |      195.049us | 433.918us |  436.928us |           1
│├── 6         |      881.273us |   3.541ms |    3.526ms |           1
│├── 7         |       63.520us |  78.270us |   78.144us |           1
│├── 8         |      732.715us |   2.950ms |    3.202ms |           1
│├── 9         |       74.500us |  93.040us |   94.048us |           1
│├── 1[...]
{'fraction_non_alphanumeric': 0.15934579439252336, 'fraction_numerical': 0.102803738317757, 'mean_word_length': 1.8622994652406417, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '333114', 'license': 'MIT', 'n_tokens_mistral': 877, 'n_tokens_neox': 757, 'n_words': 170, 'path': 'notebooks/Function_Testing.ipynb', 'repo_name': 'Data-drone/lightning_vision', 'size': '2140'}