U C^@s^ddlmZddlmZddlmZddlmZmZejededd Gd d d eZ d S) )unicode_literals)Model)describe) DimensionAttributeDescriptionz4Number of surrounding tokens on each side to extractz6Number of nearest tokens to skip, to offset the window)nWgapc@s8eZdZdZdZdddZddZdd d Zd d ZdS) ExtractWindowzAdd context to vectors in a sequence by concatenating n surrounding vectors. If the input is (10, 32) and n=1, the output will be (10, 96), with output[i] made up of (input[i-1], input[i], input[i+1]). Zextract_windowrcCs&|dks tt|||_||_dS)Nr)AssertionErrorr__init__r r )selfr r rD/tmp/pip-install-6_kvzl1k/thinc/thinc/neural/_classes/convolution.pyrs  zExtractWindow.__init__cCs|j||jSN)opsseq2colr )rXrrrpredictszExtractWindow.predictcCs |j||j}|}||fSr)rrr _get_finish_update)rZX__biZdropZX__bo finish_updaterrr begin_update szExtractWindow.begin_updatecsdfdd }|S)Ncsj|jSr)rZbackprop_seq2colr )ZgradientZsgdrrrr&sz7ExtractWindow._get_finish_update..finish_update)Nr)rrrrrr%sz ExtractWindow._get_finish_updateN)r r)r) __name__ __module__ __qualname____doc__namerrrrrrrrr s   r N) __future__rmodelrrrr attributesr rrrrs