示例#1
0
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
     foreach (LSTMAttentionDecoderCell item in m_decoders)
     {
         item.Reset(weightFactory, batchSize);
     }
 }
示例#2
0
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
     foreach (var item in m_decoders)
     {
         item.Reset(weightFactory, batchSize);
     }
 }
示例#3
0
        public ComputeGraphTensor(IWeightFactory weightFactory, int deviceId, bool needBack = true)
        {
            weightTensorFactory = weightFactory as WeightTensorFactory;

            needs_backprop = needBack;
            this.deviceId  = deviceId;
        }
示例#4
0
        public ComputeGraph(IWeightFactory weightFactory, bool needBack = true)
        {
            weightMatrixFactory = weightFactory as WeightMatrixFactory;


            this.needs_backprop = needBack;
        }
 public void Reset(IWeightFactory weightFactory)
 {
     foreach (var item in decoders)
     {
         item.Reset(weightFactory);
     }
 }
示例#6
0
 public void SetBatchSize(IWeightFactory weightFactory, int batchSize)
 {
     foreach (var item in encoders)
     {
         item.SetBatchSize(weightFactory, batchSize);
     }
 }
示例#7
0
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
     foreach (LSTMCell item in encoders)
     {
         item.Reset(weightFactory, batchSize);
     }
 }
 public void SetBatchSize(IWeightFactory weightFactory, int batchSize)
 {
     attentionLayer.SetBatchSize(batchSize);
     foreach (var item in decoders)
     {
         item.SetBatchSize(weightFactory, batchSize);
     }
 }
示例#9
0
        public void Reset(IWeightFactory weightFactory)
        {
            foreach (var item in forwardEncoders)
            {
                item.Reset(weightFactory);
            }

            foreach (var item in backwardEncoders)
            {
                item.Reset(weightFactory);
            }
        }
示例#10
0
        public void Reset(IWeightFactory weightFactory, int batchSize)
        {
            foreach (var item in m_forwardEncoders)
            {
                item.Reset(weightFactory, batchSize);
            }

            foreach (var item in m_backwardEncoders)
            {
                item.Reset(weightFactory, batchSize);
            }
        }
示例#11
0
        public ComputeGraphTensor(IWeightFactory weightFactory, int deviceId, bool needBack = true, bool visNetwork = false, ConcurrentList <Action> backprop = null)
        {
            m_backprop            = backprop != null ? backprop : new ConcurrentList <Action>();
            m_weightTensorFactory = weightFactory as WeightTensorFactory;
            m_needsBackprop       = needBack;
            m_deviceId            = deviceId;
            m_visNeuralNetwork    = visNetwork;

            if (m_visNeuralNetwork)
            {
                // Initialize parameters for neural network visualization
                m_opsViz   = new Microsoft.Msagl.Drawing.Graph();
                m_setEdges = new HashSet <string>();
            }
        }
示例#12
0
        public void Reset(IWeightFactory weightFactory, int batchSize)
        {
            if (this.m_hidden != null)
            {
                this.m_hidden.Dispose();
                this.m_hidden = null;
            }

            if (this.m_cell != null)
            {
                this.m_cell.Dispose();
                this.m_cell = null;
            }

            this.m_hidden = weightFactory.CreateWeightTensor(batchSize, this.m_hdim, this.m_deviceId, true, $"{this.m_name}.{nameof(this.m_hidden)}", true);
            this.m_cell   = weightFactory.CreateWeightTensor(batchSize, this.m_hdim, this.m_deviceId, true, $"{this.m_name}.{nameof(this.m_cell)}", true);
        }
示例#13
0
        public void Reset(IWeightFactory weightFactory, int batchSize)
        {
            if (m_hidden != null)
            {
                m_hidden.Dispose();
                m_hidden = null;
            }

            if (m_cell != null)
            {
                m_cell.Dispose();
                m_cell = null;
            }

            m_hidden = weightFactory.CreateWeightTensor(batchSize, m_hdim, m_deviceId, true, name: $"{m_name}.{nameof(m_hidden)}", isTrainable: true);
            m_cell   = weightFactory.CreateWeightTensor(batchSize, m_hdim, m_deviceId, true, name: $"{m_name}.{nameof(m_cell)}", isTrainable: true);
        }
示例#14
0
        public ComputeGraphTensor(IWeightFactory weightFactory, int deviceId, bool needBack = true, ConcurrentList <Action> backprop = null, bool isSubGraph = false)
        {
            m_backprop            = backprop != null ? backprop : new ConcurrentList <Action>();
            m_weightTensorFactory = weightFactory as WeightTensorFactory;
            m_needsBackprop       = needBack;
            m_deviceId            = deviceId;
            //m_visNeuralNetwork = visNetwork;
            m_isSubGraph = isSubGraph;

            //m_name2SubGraph = new Dictionary<string, Subgraph>();
            //if (m_visNeuralNetwork)
            //{
            //    // Initialize parameters for neural network visualization
            //    m_opsViz = new Microsoft.Msagl.Drawing.Graph();
            //    m_setEdges = new HashSet<string>();
            //}

            m_tensorsBindToCurrentGraph = new List <IWeightTensor>();
        }
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
     this.Hidden = weightFactory.CreateWeightTensor(batchSize, this.m_hiddenDim, this.m_deviceId, true, $"{this.m_name}.{nameof(this.Hidden)}", true);
     this.Cell   = weightFactory.CreateWeightTensor(batchSize, this.m_hiddenDim, this.m_deviceId, true, $"{this.m_name}.{nameof(this.Cell)}", true);
 }
示例#16
0
 private void Reset(IWeightFactory weightFactory, Encoder encoder, Encoder reversEncoder, AttentionDecoder decoder)
 {
     encoder.Reset(weightFactory);
     reversEncoder.Reset(weightFactory);
     decoder.Reset(weightFactory);
 }
 public void Reset(IWeightFactory weightFactory)
 {
     Hidden = weightFactory.CreateWeights(m_batchSize, m_hdim, m_deviceId, true, name: $"{m_name}.{nameof(Hidden)}", isTrainable: true);
     Cell   = weightFactory.CreateWeights(m_batchSize, m_hdim, m_deviceId, true, name: $"{m_name}.{nameof(Cell)}", isTrainable: true);
 }
示例#18
0
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
 }
示例#19
0
 public void Reset(IWeightFactory weightFactory, int batchSize)
 {
     Hidden = weightFactory.CreateWeightTensor(batchSize, m_hiddenDim, m_deviceId, true, name: $"{m_name}.{nameof(Hidden)}", isTrainable: true);
     Cell   = weightFactory.CreateWeightTensor(batchSize, m_hiddenDim, m_deviceId, true, name: $"{m_name}.{nameof(Cell)}", isTrainable: true);
 }
示例#20
0
 public void SetBatchSize(IWeightFactory weightFactory, int batchSize)
 {
     this.batchSize = batchSize;
     Reset(weightFactory);
 }
示例#21
0
 public void Reset(IWeightFactory weightFactory)
 {
     ht = weightFactory.CreateWeights(batchSize, hdim, deviceId, true);
     ct = weightFactory.CreateWeights(batchSize, hdim, deviceId, true);
 }
示例#22
0
 public ComputeGraphMKL(IWeightFactory weightFactory, bool needBack = true)
     : base(weightFactory, needBack)
 {
 }
示例#23
0
 public void Reset(IWeightFactory weightFactory)
 {
 }