Support Scalar type as the Disc module input/output type
- Dominant language
- C++
- Stars
- 933
- Forks
- 169
- PR merge metrics
- No merged PRs in 30d
Description
To enable BladeDISC compilable, the input and output should be Tensor type, It works well in TensorFlow world, but insufficient in PyTorch world, because a considerable number of inputs/outputs is Scalar type as the following illustration:
```yaml
- func: add.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
```
A workaround way is that casting it to Tensor outside of Disc cluster and cast back to Scalar inner cluster as the following illustration:
```text
Give:
with prim::FusionGroup(
%1: Scalar,
%2: Scalar):
%3 Tensor = aten::add(%1, %2)
return %3
Execute: CastScalarInputs(sub_graph)
After:
with prim::FusionGroup(
%1.1: Tensor,
%2.1: Tensor):
%4 int = aten::item(%1.1, 1)
%5 int = aten::item(%2.1, 1)
%3 Tensor = aten::add(%4, %5)
return %3
```
Maybe to support Scalar as the input type in Disc is a better way.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.