a = paddle.to_tensor([0, 0, 1, 1])
b = paddle.to_tensor([1.2, 1.3, 2.1, 2.4])
a * b # int64 int * float = int ???
Tensor(shape=[4], dtype=int64, place=CPUPlace, stop_gradient=True,
[0, 0, 2, 2])
c = paddle.to_tensor([1.2, 1.3, 2.1, 2])
Tensor(shape=[4], dtype=int64, place=CPUPlace, stop_gradient=True,
[0, 0, 2, 2])
Tensor(shape=[4], dtype=float32, place=CPUPlace, stop_gradient=True,
[1.44000006, 1.68999982, 4.40999937, 4.80000019])
Tensor(shape=[4], dtype=float32, place=CPUPlace, stop_gradient=True,
[0., 0., 1., 1.])
bool_a = paddle.to_tensor([True, False])
bool_a
Tensor(shape=[2], dtype=bool, place=CPUPlace, stop_gradient=True,
[True , False])
Tensor(shape=[2], dtype=int64, place=CPUPlace, stop_gradient=True,
[1, 0])
Share on:
Twitter
❄ Facebook
❄ Email