bilinear.py 627 Bytes
Newer Older
PanZezhong's avatar
PanZezhong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from infinicore.lib import _infinicore
from infinicore.tensor import Tensor


def bilinear(input1, input2, weight, bias=None, *, out=None):
    if out is None:
        return Tensor(
            _infinicore.bilinear(
                input1._underlying,
                input2._underlying,
                weight._underlying,
                bias._underlying if bias is not None else None,
            )
        )
    _infinicore.bilinear_(
        out._underlying,
        input1._underlying,
        input2._underlying,
        weight._underlying,
        bias._underlying if bias is not None else None,
    )

    return out