Skip to content

Instantly share code, notes, and snippets.

View codingsnap's full-sized avatar
🎯
Focusing

Rahul Singh codingsnap

🎯
Focusing
  • New Delhi, India
View GitHub Profile
<music21.note.Note A> 0.0
<music21.note.Note A> 0.0
<music21.note.Note A> 0.0
<music21.note.Note A> 0.25
<music21.note.Note G> 2/3
<music21.note.Note G> 2/3
<music21.note.Note F#> 1.0
<music21.note.Note F#> 1.25
<music21.note.Note D> 1.5
<music21.note.Note D> 1.5
from music21 import converter, instrument, note, chord, stream
import glob
import pickle
import numpy as np
from keras.utils import np_utils
np.diag(a)
Output: array([1, 2, 3, 4])
a = np.diag([1,2,3,4])
print(a)
Output:
[[1 0 0 0]
[0 2 0 0]
[0 0 3 0]
[0 0 0 4]]
a = np.eye(5)
print(a)
Output:
[[1. 0. 0. 0. 0.]
[0. 1. 0. 0. 0.]
[0. 0. 1. 0. 0.]
[0. 0. 0. 1. 0.]
[0. 0. 0. 0. 1.]]
a = np.ones(5)
print(a)
Output: [1. 1. 1. 1. 1.]
a = np.ones((5,5))
print(a)
Output:
a = np.zeros(4)
print(a)
Output: [0. 0. 0. 0.]
a = np.zeros((3,4))
print(a)
Output:
[[0. 0. 0. 0.]
a = np.array([[[1,2],[3,4]],[[5,6],[7,8]]])
print(a)
Output:
[[[1 2]
[3 4]]
[[5 6]
[7 8]]]
a = np.array([[1,2,3,4],[5,6,7,8]])
print(a)
Output:
[[1 2 3 4]
[5 6 7 8]]
a = np.linspace(1,10,5)
print(a)
Output:
[ 1. 3.25 5.5 7.75 10. ]