가정하자 우리 maxPooling1D(pool_size=2, strides=1).
이어서
the [[.7, -0.2, .1] | pool size is two
boy [.8, -.3, .2] | so look at two words at a time | stride=1 will
will [.2, -.1, .4] and take the max over those | move the pool down
live [.4 -.4, .8]] 2 vectors. Here we looking 1 word. Now we look
'the' and 'boy'. 'boy' and 'will' and
take the max.
는 그래서이 될 것이다가 [1, 3,3]로 텐서 ㄱ 2D 풀 위에 최대 인 각 시간 단계. 그리고 우리는 3 개의 풀을 가지고 있으므로 우리의 시간 단계를 4에서 3으로 효과적으로 다운 샘플링했습니다.
그러나 GlobalPooling1D
을 사용하면 해당 문장의 최대 벡터 (Tensor)가 사용됩니다.이 벡터는 아마도 ' 살고 있다'. 내가 무엇을 명확히하기 위해 실제로
가, 여기에 GlobalMaxPooling1D가 도움이 keras
class GlobalMaxPooling1D(_GlobalPooling1D):
"""Global max pooling operation for temporal data.
# Input shape
3D tensor with shape: `(batch_size, steps, features)`.
# Output shape
2D tensor with shape:
`(batch_size, channels)`
"""
def call(self, inputs):
return K.max(inputs, axis=1)
희망에 정의하는 방법, 문의하시기 바랍니다. 좋은 설명입니다
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, LSTM, MaxGlobalMaxPooling1D
D = np.random.rand(10, 6, 10)
model = Sequential()
model.add(LSTM(16, input_shape=(6, 10), return_sequences=True))
model.add(MaxPooling1D(pool_size=2, strides=1))
model.add(LSTM(10))
model.add(Dense(1))
model.compile(loss='binary_crossentropy', optimizer='sgd')
# print the summary to see how the dimension change after the layers are
# applied
print(model.summary())
# try a model with MaxGlobalPooling1D now
model = Sequential()
model.add(LSTM(16, input_shape=(6, 10), return_sequences=True))
model.add(GlobalMaxPooling1D())
model.add(Dense(1))
model.compile(loss='binary_crossentropy', optimizer='sgd')
print(model.summary())
: 또한 여기
은 당신이 재생할 수있는 예이다. 고마워요! – KayBay[x, y, z] 텐서 란 무엇입니까? 나는 tensors에 익숙하지 않다. 3 차원 선형 관계 객체라는 것을 이해합니다. 그리고 수영장은 무엇입니까? 이 경우에 읽는 단어의 수입니까? 설명하기에는 너무 길다면 저를 링크 나 튜토리얼로 리디렉션하는 것을 망설이지 마십시오. – Marine1