Skip to content

Commit

Permalink
🤖 Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-branch committed May 14, 2024
1 parent 55bce45 commit 0712612
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ivy/functional/backends/tensorflow/activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def gelu(
) -> Tensor:
if x.dtype in [tf.complex64, tf.complex128]:
return 0.5 * x * (1 + tf.math.tanh(0.7978845608 * (x + 0.044715 * x * x * x)))

return tf.nn.gelu(x, approximate)


Expand Down
1 change: 0 additions & 1 deletion ivy/functional/frontends/torch/pointwise_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def acos(input, *, out=None):
@with_unsupported_dtypes({"2.2 and below": ("float16",)}, "torch")
@to_ivy_arrays_and_back
def acosh(input, *, out=None):

return ivy.acosh(input, out=out)


Expand Down
1 change: 0 additions & 1 deletion ivy/functional/ivy/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ def linear(
),
)


if ivy.exists(bias):
# OBS x [1]*len(IBS) x OF
bias_broadcast = ivy.reshape(
Expand Down
27 changes: 13 additions & 14 deletions scripts/run_tests_from_diff.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
"""
Script that attempts to find the test file(s) corresponding the all the changes made
in a commit (git diff stored in commit-diff.txt), and runs all the tests it finds
"""
"""Script that attempts to find the test file(s) corresponding the all the
changes made in a commit (git diff stored in commit-diff.txt), and runs all the
tests it finds."""

import os
import re
import subprocess
import sys


with open('commit-diff.txt', 'r') as f:
with open("commit-diff.txt", "r") as f:
diff_lines = f.readlines()

modified_files = set()
for line in diff_lines:
if line.startswith('diff --git a/'):
file_path = line.split(' ')[2].strip().lstrip('a/')
if line.startswith("diff --git a/"):
file_path = line.split(" ")[2].strip().lstrip("a/")
modified_files.add(file_path)
elif line.startswith('diff --git b/'):
file_path = line.split(' ')[2].strip().lstrip('b/')
elif line.startswith("diff --git b/"):
file_path = line.split(" ")[2].strip().lstrip("b/")
modified_files.add(file_path)
elif line.startswith('diff --git '):
file_path = line.split(' ')[2].strip().lstrip('--git ')
elif line.startswith("diff --git "):
file_path = line.split(" ")[2].strip().lstrip("--git ")
modified_files.add(file_path)

nn = [
Expand All @@ -38,9 +37,9 @@
file_path = file_path.replace("/functional", "")

if "/backends/" in file_path:
suffix = file_path.rsplit('/', 1)[1].replace(".py", "")
suffix = file_path.rsplit("/", 1)[1].replace(".py", "")
file_path = re.sub(r"/backends/.*?/", "/", file_path)
file_path = file_path.rsplit('/', 1)[0]
file_path = file_path.rsplit("/", 1)[0]
if suffix in nn:
file_path += f"/nn/{suffix}.py"
else:
Expand All @@ -53,7 +52,7 @@

# if the test file doesn't exist, step up a directory and run those tests instead (if that exists)
if not os.path.exists(file_path):
file_path = file_path.rsplit('/', 1)[0]
file_path = file_path.rsplit("/", 1)[0]

if os.path.exists(file_path):
test_paths.append(file_path)
Expand Down

0 comments on commit 0712612

Please sign in to comment.