1import tensorflow as tf
2
3a = tf.constant([[1, 2], [3, 4]])
4b = tf.add(a, 1)
5
6a.numpy()
7# array([[1, 2],
8# [3, 4]], dtype=int32)
9
10b.numpy()
11# array([[2, 3],
12# [4, 5]], dtype=int32)
13
14tf.multiply(a, b).numpy()
15# array([[ 2, 6],
16# [12, 20]], dtype=int32)
17
1l = list(torch.tensor([1,2,3]))
2print(l)
3>>>[tensor(1), tensor(2), tensor(3)]
4k = torch.stack(l)
5print(k)
6>>>tensor([1, 2, 3])