public AttentionDecoder(int sdim, int hdim, int dim, int depth)
        {
            Attention  = new AttentionUnit(hdim);
            this.hdim  = hdim;
            this.dim   = dim;
            this.depth = depth;

            decoders.Add(new LSTMAttentionDecoderCell(sdim, hdim, dim));
            for (int i = 1; i < depth; i++)
            {
                decoders.Add(new LSTMAttentionDecoderCell(0, hdim, hdim));
            }
        }
        public AttentionDecoder(int batchSize, int hdim, int dim, int context, int depth, ArchTypeEnums archType, int deviceId, bool isDefaultDevice)
        {
            attentionLayer = new AttentionUnit(batchSize, hdim, context, archType, deviceId, isDefaultDevice);
            this.hdim      = hdim;
            this.dim       = dim;
            this.depth     = depth;

            decoders.Add(new LSTMAttentionDecoderCell(batchSize, hdim, dim, archType, deviceId, isDefaultDevice));
            for (int i = 1; i < depth; i++)
            {
                decoders.Add(new LSTMAttentionDecoderCell(batchSize, hdim, hdim, archType, deviceId, isDefaultDevice));
            }
        }
        public AttentionDecoder(string name, int batchSize, int hdim, int dim, int context, int depth, int deviceId)
        {
            attentionLayer = new AttentionUnit($"{name}.AttnUnit", batchSize, hdim, context, deviceId);
            this.hdim      = hdim;
            this.dim       = dim;
            this.depth     = depth;
            m_name         = name;

            decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_0", batchSize, hdim, dim, context, deviceId));
            for (int i = 1; i < depth; i++)
            {
                decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_{i}", batchSize, hdim, hdim, context, deviceId));
            }
        }
示例#4
0
        public AttentionDecoder(string name, int hiddenDim, int embeddingDim, int contextDim, int depth, int deviceId)
        {
            m_attentionLayer = new AttentionUnit($"{name}.AttnUnit", hiddenDim, contextDim, deviceId);

            m_name     = name;
            m_hdim     = hiddenDim;
            m_dim      = embeddingDim;
            m_context  = contextDim;
            m_depth    = depth;
            m_deviceId = deviceId;

            m_decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_0", hiddenDim, embeddingDim, contextDim, deviceId));
            for (int i = 1; i < depth; i++)
            {
                m_decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_{i}", hiddenDim, hiddenDim, contextDim, deviceId));
            }
        }
示例#5
0
        public AttentionDecoder(string name, int hiddenDim, int embeddingDim, int contextDim, float dropoutRatio, int depth, int deviceId, bool enableCoverageModel, bool isTrainable)
        {
            m_name     = name;
            m_hdim     = hiddenDim;
            m_embDim   = embeddingDim;
            m_context  = contextDim;
            m_depth    = depth;
            m_deviceId = deviceId;
            //     m_outputDim = outputDim;
            m_dropoutRatio        = dropoutRatio;
            m_enableCoverageModel = enableCoverageModel;
            m_isTrainable         = isTrainable;

            m_attentionLayer = new AttentionUnit($"{name}.AttnUnit", hiddenDim, contextDim, deviceId, enableCoverageModel, isTrainable: isTrainable);

            m_decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_0", hiddenDim, embeddingDim, contextDim, deviceId, isTrainable));
            for (int i = 1; i < depth; i++)
            {
                m_decoders.Add(new LSTMAttentionDecoderCell($"{name}.LSTMAttn_{i}", hiddenDim, hiddenDim, contextDim, deviceId, isTrainable));
            }

            //     m_decoderFFLayer = new FeedForwardLayer($"{name}.FeedForward", hiddenDim, outputDim, 0.0f, deviceId: deviceId, isTrainable: isTrainable);
        }
示例#6
0
        public INeuralUnit CloneToDeviceAt(int deviceId)
        {
            AttentionUnit a = new AttentionUnit(m_name, m_hiddenDim, m_contextDim, deviceId, m_enableCoverageModel, m_isTrainable);

            return(a);
        }
示例#7
0
        public INeuralUnit CloneToDeviceAt(int deviceId)
        {
            AttentionUnit a = new AttentionUnit(m_name, m_hiddenDim, m_contextDim, deviceId);

            return(a);
        }