Skip to content

Commit

Permalink
Standardize license headers in Python files (#79)
Browse files Browse the repository at this point in the history
Automated merge of Ultralytics Code Refactor
  • Loading branch information
pderrenger authored Jan 15, 2025
1 parent 9e6269c commit 630da13
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 5 deletions.
2 changes: 2 additions & 0 deletions benchmark/evaluate_famous_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
from torchvision import models

Expand Down
2 changes: 2 additions & 0 deletions benchmark/evaluate_rnn_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
import torch.nn as nn

Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
8 changes: 5 additions & 3 deletions tests/test_conv2d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
import torch.nn as nn

Expand Down Expand Up @@ -54,6 +56,6 @@ def test_conv2d_random(self):

flops, params = profile(net, inputs=(data,))
print(flops, params)
assert (
flops == n * out_c * oh * ow // g * in_c * kh * kw
), f"{flops} v.s. {n * out_c * oh * ow // g * in_c * kh * kw}"
assert flops == n * out_c * oh * ow // g * in_c * kh * kw, (
f"{flops} v.s. {n * out_c * oh * ow // g * in_c * kh * kw}"
)
2 changes: 2 additions & 0 deletions tests/test_matmul.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
import torch.nn as nn

Expand Down
2 changes: 2 additions & 0 deletions tests/test_relu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
import torch.nn as nn

Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

from thop import utils


Expand Down
2 changes: 2 additions & 0 deletions thop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

__version__ = "2.0.13"


Expand Down
5 changes: 3 additions & 2 deletions thop/fx_profile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import logging
from distutils.version import LooseVersion

Expand All @@ -7,8 +9,7 @@

if LooseVersion(torch.__version__) < LooseVersion("1.8.0"):
logging.warning(
f"torch.fx requires version higher than 1.8.0. "
f"But You are using an old version PyTorch {torch.__version__}. "
f"torch.fx requires version higher than 1.8.0. But You are using an old version PyTorch {torch.__version__}. "
)


Expand Down
2 changes: 2 additions & 0 deletions thop/profile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

from thop.rnn_hooks import *
from thop.vision.basic_hooks import *

Expand Down
2 changes: 2 additions & 0 deletions thop/rnn_hooks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import torch
import torch.nn as nn
from torch.nn.utils.rnn import PackedSequence
Expand Down
2 changes: 2 additions & 0 deletions thop/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

from collections.abc import Iterable

COLOR_RED = "91m"
Expand Down
1 change: 1 addition & 0 deletions thop/vision/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2 changes: 2 additions & 0 deletions thop/vision/basic_hooks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import logging

import torch.nn as nn
Expand Down
2 changes: 2 additions & 0 deletions thop/vision/calc_func.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

import warnings

import numpy as np
Expand Down

0 comments on commit 630da13

Please sign in to comment.