diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_abs.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_abs.py index 8da3ec8cd2b..0b4380dc10c 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_abs.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_abs.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_abs(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_add.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_add.py index 3ee97d726c3..9fae9db1c10 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_add.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_add.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,9 +30,7 @@ def test_bw_add(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addalpha.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addalpha.py index 165561720ea..422e4f6532d 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addalpha.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addalpha.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -31,9 +31,7 @@ def test_bw_addalpha(input_shapes, alpha, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcdiv.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcdiv.py index c7380f745a9..9865a085570 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcdiv.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcdiv.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -36,10 +36,7 @@ def test_bw_addcdiv(input_shapes, value, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(tensor1_data.grad) - golden_tensor.append(tensor2_data.grad) + golden_tensor = [in_data.grad, tensor1_data.grad, tensor2_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcmul.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcmul.py index e58fc18a24c..eb8bfe925e7 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcmul.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_addcmul.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -36,10 +36,7 @@ def test_bw_addcmul(input_shapes, value, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(tensor1_data.grad) - golden_tensor.append(tensor2_data.grad) + golden_tensor = [in_data.grad, tensor1_data.grad, tensor2_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_assign.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_assign.py index 02fc5d74b04..6335170a193 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_assign.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_assign.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,7 +30,6 @@ def test_bw_binary_assign(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_le.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_le.py index 14c135c150d..e7835604300 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_le.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_binary_le.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -22,8 +22,6 @@ def test_bw_binary_le(input_shapes, device): tt_output_tensor_on_device = tt_lib.tensor.binary_le_bw(grad_tensor, input_tensor) pt_y = torch.zeros_like(grad_data) - golden_tensor = list() - golden_tensor.append(pt_y) - golden_tensor.append(pt_y) + golden_tensor = [pt_y, pt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp.py index 0e3ef04d123..b9e380fd969 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,7 +30,6 @@ def test_bw_clamp(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_max.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_max.py index b31f44a5512..94ade8a9de8 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_max.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_max.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_clamp_max(input_shapes, max, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_min.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_min.py index ddf33658b88..ec3ffc5abd1 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_min.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_clamp_min.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_clamp_min(input_shapes, min, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_div.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_div.py index 654ea77eb77..83a41740086 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_div.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_div.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,9 +30,7 @@ def test_bw_div(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_exp.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_exp.py index c5719044f71..49cd4fca41b 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_exp.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_exp.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_exp(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill.py index 5186b6c4597..55afa549b75 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -22,7 +22,7 @@ # value: grad.sum() # result: at::fill(self_t, value_t) def test_bw_fill(input_shapes, device): - torch.manual_seed(12386) + # torch.manual_seed(12386) grad_data, grad_tensor = data_gen_pt_tt(input_shapes, device) pyt_y = torch.zeros_like(grad_data) grad_sum = grad_data.sum() @@ -30,7 +30,6 @@ def test_bw_fill(input_shapes, device): tt_output_tensor_on_device = tt_lib.tensor.fill_bw(grad_tensor) - golden_tensor = list() - golden_tensor.append(pyt_y) + golden_tensor = [pyt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill_zero.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill_zero.py index b9329dc57e6..fe0fc2dcf05 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill_zero.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_fill_zero.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -24,7 +24,6 @@ def test_bw_fill_zero(input_shapes, device): grad_data, grad_tensor = data_gen_pt_tt(input_shapes, device) tt_output_tensor_on_device = tt_lib.tensor.fill_zero_bw(grad_tensor) pyt_y = torch.zeros_like(grad_data) - golden_tensor = list() - golden_tensor.append(pyt_y) + golden_tensor = [pyt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_gt.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_gt.py index 547084ca144..c108299c81b 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_gt.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_gt.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -22,8 +22,7 @@ def test_bw_unary_gt(input_shapes, device): pyt_y = torch.zeros_like(grad_data) - golden_tensor = list() - golden_tensor.append(pyt_y) + golden_tensor = [pyt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_log.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_log.py index 0feeb275536..ec50286ebc0 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_log.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_log.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( @@ -27,8 +27,6 @@ def test_bw_log(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_lt.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_lt.py index 6c1d26af8cc..67ba4d95429 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_lt.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_lt.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -21,8 +21,7 @@ def test_bw_unary_lt(input_shapes, device): tt_output_tensor_on_device = tt_lib.tensor.lt_bw(grad_tensor) pyt_y = torch.zeros_like(grad_data) - golden_tensor = list() - golden_tensor.append(pyt_y) + golden_tensor = [pyt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_max.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_max.py index a2078e015b1..baadf764815 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_max.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_max.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( @@ -30,9 +30,7 @@ def test_bw_max(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_min.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_min.py index a26676b676d..07c5a27562b 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_min.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_min.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,9 +30,6 @@ def test_bw_min(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) - + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_mul.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_mul.py index 2e8151b2d8c..b4c4c6b61fb 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_mul.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_mul.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,9 +30,7 @@ def test_bw_mul(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data_a.grad) - golden_tensor.append(in_data_b.grad) + golden_tensor = [in_data_a.grad, in_data_b.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_ne.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_ne.py index 808fdad4a02..f1aab1d3f64 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_ne.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_ne.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -21,8 +21,7 @@ def test_bw_unary_ne(input_shapes, device): tt_output_tensor_on_device = tt_lib.tensor.ne_bw(grad_tensor) pyt_y = torch.zeros_like(grad_data) - golden_tensor = list() - golden_tensor.append(pyt_y) + golden_tensor = [pyt_y] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_neg.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_neg.py index 215ec877d17..ed955069d2c 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_neg.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_neg.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_neg(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_relu.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_relu.py index a01318dc43d..9bcbc6e0d5d 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_relu.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_relu.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsqrt.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsqrt.py index 3f7fb9f0073..2a77df835ee 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsqrt.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsqrt.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_rsqrt(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsub.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsub.py index 48d4cc84b42..bf7319bf222 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsub.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_rsub.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -31,9 +31,7 @@ def test_bw_rsub(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sigmoid.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sigmoid.py index 172a2cfdd04..34e21dbc104 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sigmoid.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sigmoid.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -17,7 +17,6 @@ ), ) def test_bw_sigmoid(input_shapes, device): - torch.manual_seed(12386) in_data, input_tensor = data_gen_pt_tt(input_shapes, device, True) grad_data, grad_tensor = data_gen_pt_tt(input_shapes, device) @@ -29,8 +28,7 @@ def test_bw_sigmoid(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor, 0.90) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sqrt.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sqrt.py index f9e64bdcfaf..c330e42c71c 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sqrt.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sqrt.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,7 +28,6 @@ def test_bw_sqrt(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sub.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sub.py index 0174191b81e..de4ada95193 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sub.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_sub.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -30,9 +30,7 @@ def test_bw_sub(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tan.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tan.py index 97e0da76652..495032c9bb9 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tan.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tan.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -32,7 +32,6 @@ def test_bw_tan(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor, 0.96) assert comp_pass diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tanh.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tanh.py index 1fb29bdd20a..54e2f05a104 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tanh.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_tanh.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import compare_results, data_gen_pt_tt @pytest.mark.parametrize( @@ -27,8 +27,7 @@ def test_bw_tanh(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor, 0.95) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_add.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_add.py index 69a45e77da4..73d7771846c 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_add.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_add.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -29,8 +29,7 @@ def test_bw_unary_add(input_shapes, alpha, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_assign.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_assign.py index 8a162dc99b5..80372588286 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_assign.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_assign.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -28,8 +28,7 @@ def test_bw_unary_assign(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_div.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_div.py index 064ef64ddf3..61b29d1f1fa 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_div.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_div.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -29,8 +29,7 @@ def test_bw_unary_div(input_shapes, scalar, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_mul.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_mul.py index 399e64a59b6..82aa58dde93 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_mul.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_mul.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -29,8 +29,7 @@ def test_bw_unary_mul(input_shapes, scalar, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_pow.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_pow.py index 1eeb203f353..060b65d646d 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_pow.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_pow.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -36,8 +36,7 @@ def test_bw_unary_pow(input_shapes, exponent, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_sub.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_sub.py index 1b31a75e5b4..4f9e59e2b1c 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_sub.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_unary_sub.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -29,8 +29,7 @@ def test_bw_unary_sub(input_shapes, scalar, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) + golden_tensor = [in_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_where.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_where.py index 1f82a99e403..b425bef7894 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_where.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_where.py @@ -5,7 +5,7 @@ import torch import pytest import tt_lib -from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import * +from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results @pytest.mark.parametrize( @@ -36,9 +36,7 @@ def test_bw_where(input_shapes, device): pyt_y.backward(gradient=grad_data) - golden_tensor = list() - golden_tensor.append(in_data.grad) - golden_tensor.append(other_data.grad) + golden_tensor = [in_data.grad, other_data.grad] status = compare_results(tt_output_tensor_on_device, golden_tensor) assert status diff --git a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/utility_funcs.py b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/utility_funcs.py index 336727fc4b2..7891322dacf 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/backward_ops/utility_funcs.py +++ b/tests/tt_eager/python_api_testing/unit_testing/backward_ops/utility_funcs.py @@ -12,6 +12,7 @@ def data_gen_pt_tt(input_shapes, device, required_grad=False): + torch.manual_seed(213919) pt_tensor = torch.randn(input_shapes, requires_grad=required_grad).bfloat16() tt_tensor = ( tt_lib.tensor.Tensor(pt_tensor, tt_lib.tensor.DataType.BFLOAT16).to(tt_lib.tensor.Layout.TILE).to(device)