RP-FIZ
12. 12. 2023
Vir slik:
Alammar, J (2018). The Illustrated Transformer [Blog post]. Retrieved from https://jalammar.github.io/illustrated-transformer/
import numpy as np
podatki = np.array([1, 2, 3])
print(podatki)
# [1 2 3]
podatki = np.linspace(0, 10, 5)
print(podatki)
# [ 0. 2.5 5. 7.5 10. ]
podatki = np.linspace(0, 10, 8)
print(podatki)
# [ 0. 1.42857143 2.85714286 4.28571429 5.71428571 7.14285714
# 8.57142857 10. ]
podatki = np.arange(0, 10, 1)
print(podatki)
# [0 1 2 3 4 5 6 7 8 9]
podatki = np.arange(0, 10, 0.2)
print(podatki)
# [0. 0.2 0.4 0.6 0.8 1. 1.2 1.4 1.6 1.8 2. 2.2 2.4 2.6 2.8 3. 3.2 3.4
# 3.6 3.8 4. 4.2 4.4 4.6 4.8 5. 5.2 5.4 5.6 5.8 6. 6.2 6.4 6.6 6.8 7.
# 7.2 7.4 7.6 7.8 8. 8.2 8.4 8.6 8.8 9. 9.2 9.4 9.6 9.8]
import numpy as np
data = np.array([1, 2])
ones = np.ones(2)
rezultat = data + ones
data = np.array([[1, 2], [3, 4], [5, 6]])
print(data.shape)
# (3, 2)
data = np.array([[1, 2], [3, 4], [5, 6]])
print(data)
# [[1 2]
# [3 4]
# [5 6]]