• 검색 결과가 없습니다.

RNN (Recurrent Neural Network)

N/A
N/A
Protected

Share "RNN (Recurrent Neural Network)"

Copied!
18
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

(2)

(3)

(4)

(5)

tanh +

(6)

(7)

Example: ‘hello’

import torch

import numpy as np

torch.manual_seed(0) # to make results deterministic and reproducible

unique_characters = ['h', 'e', 'l', ‘o'] INPUT_SIZE  = len(unique_characters) # = 4 HIDDEN_SIZE = len(unique_characters) # = 4 x_data = [[0, 1, 2, 2]] # hell # batch_size = 1 x_one_hot = [[[1, 0, 0, 0],  # ‘h'       [0, 1, 0, 0],  # ‘e'       [0, 0, 1, 0],  # ‘l'       [0, 0, 1, 0]]] # ‘l' y_data = [[1, 2, 2, 3]] # ello x = torch.FloatTensor(x_one_hot) y = torch.LongTensor(y_data)

(8)

Example: ‘hello’

# batch_first guarantees the order = (batch_size, sequence_length, data_size)

model = torch.nn.RNN(INPUT_SIZE, HIDDEN_SIZE, batch_first=True)

CostFunc = torch.nn.CrossEntropyLoss()

optimizer = torch.optim.Adam(model.parameters(), lr=0.1) for i in range(10):

outputs, _ = model(x)

cost = CostFunc(outputs.view(-1, INPUT_SIZE), y.view(-1))     cost.backward()

optimizer.step()

result = outputs.data.numpy().argmax(axis=2)

result = ''.join([unique_characters[c] for c in np.squeeze(result)])     print(result) # ello

(9)

(10)

(11)

(12)

(13)

(14)
(15)
(16)
(17)

GRU

(18)

참조

관련 문서

시간에 종속되는 통행 속도의 특 성을 반영하기 위해 적용되었던 시계열 분석 기법인 Autoregressive Integrated Moving Average(ARIMA)와 순환 신경망(Recurrent

Degree Centrality The counts of how many connections a node has Popularity or influence of a node (e.g., word, person) in the network Betweenness Centrality The extent to which

Four volumes of the text are used as a core text to instruct third and fourth year elementary school students in the rudiments of Korean language related to daily

Motivation – Learning noisy labeled data with deep neural network.

Human Actions Tracking and Recogni tion Based on Body Parts Detection via Artificial Neural Network.. ○ 인공 신경망 -&gt;

Human Actions Tracking and Recogni tion Based on Body Parts Detection via Artificial Neural Network.. ○ 인공 신경망 -&gt;

A Study on the Evaluation of Space Recognition Space Recognition Space Recognition in the Space Recognition in the in the in the Concourse of Hospital using the

In this chapter, we introduce unsupervised pattern recognition using a spiking neural network (SNN) based on the proposed synapse device and neuron circuit.. Unsupervised