로딩
요청 처리 중입니다...

nn.Embedding()

 nn.Embedding()

import torch train_data = 'you need to know how to code' # 중복을 제거한 단어들의 집합인 단어 집합 생성. word_set = set(train_data.split()) # 단어 집합의 각 단어에 고유한 정수 맵핑. vocab = {word: i+2 for i, word in enumerate(word_set)} vocab[''] = 0 vocab[''] = 1 print(vocab) # 단어 집합의 크기만큼의 행을 가지는 테이블 생성. embedding_table = torch.FloatTensor([ [ 0.0, 0.0, 0.0], [ 0.0, 0.0, 0.0], [ 0.2, 0.9, 0.3], [ 0.1, 0.5, 0.7], [ 0.2, 0.1, 0.8], [ 0.4, 0.1, 0.1], [ 0.1, 0.8, 0.9], [ 0.6, 0.1, 0.1]]) sample = 'you need to run'.split()...

원문 링크 : nn.Embedding()