Skip to content

Commit e52b814

Browse files
authored
[SYCLomatic] Fix pre-defined yaml rule for torch class torch::Tensor(which actually is at::Tensor) migration (#2747)
Adjust the test case to exactly follow the PyTorch define. Signed-off-by: Jiang, Zhiwei <zhiwei.jiang@intel.com>
1 parent e2fb5d9 commit e52b814

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
#pragma once
2+
namespace at {
3+
class Tensor {
4+
public:
5+
bool is_cuda();
6+
};
7+
} // namespace at
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1+
#include <ATen/Tensor.h>
12
namespace torch {
2-
class Tensor {
3-
public:
4-
bool is_cuda();
5-
};
6-
}
3+
using namespace at;
4+
} // namespace torch

clang/tools/dpct/extensions/pytorch_api_rules/pytorch_api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
- Rule: rule_torch_Tensor
156156
Kind: Class
157157
Priority: Takeover
158-
In: torch::Tensor
158+
In: at::Tensor # The underlying type of torch::Tensor is at::Tensor
159159
Out: torch::Tensor
160160
Methods:
161161
- In: is_cuda

0 commit comments

Comments
 (0)