pytorch

Форк
0
/
_test_bazel.py 
30 строк · 894.0 Байт
1
# Owner(s): ["module: bazel"]
2

3
"""
4
This test module contains a minimalistic "smoke tests" for the bazel build.
5

6
Currently it doesn't use any testing framework (i.e. pytest)
7
TODO: integrate this into the existing pytorch testing framework.
8

9
The name uses underscore `_test_bazel.py` to avoid globbing into other non-bazel configurations.
10
"""
11

12
import torch
13

14
def test_sum() -> None:
15
    assert torch.eq(torch.tensor([[1, 2, 3]]) + torch.tensor([[4, 5, 6]]), torch.tensor([[5, 7, 9]])).all()
16

17
def test_simple_compile_eager() -> None:
18

19
    def foo(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
20
        a = torch.sin(x)
21
        b = torch.cos(y)
22
        return a + b
23

24
    opt_foo1 = torch.compile(foo, backend="eager")
25
    # just check that we can run without raising an Exception
26
    assert opt_foo1(torch.randn(10, 10), torch.randn(10, 10)) is not None
27

28

29
test_sum()
30
test_simple_compile_eager()
31

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.