lstm.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:harmonizer 作者: meagtan 项目源码 文件源码
def getchords(self):
        if self.chords is None:
            self.cs = self.s.chordify()
            self.chords = []
            for c in self.cs.flat.notesAndRests:
                self.chords.append(
                    map(lambda k: (isinstance(c, chord.Chord) and \
                        k == chordtoid(c, self.key)) * float(c.quarterLength), range(Dout)))
            self.chords = torch.FloatTensor(self.chords)
        return self.chords

# for c in sc.cs.flat.notesAndRests:
#     if isinstance(c, note.Note):
#         c = chord.Chord(c)
#     sc.notes.append(map(lambda n: (isinstance(c, chord.Chord) and \
#                         (n + lstm.pitchtoid(sc.key.tonic)) % 12 in c.normalOrder) * float(c.quarterLength), range(12)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号