mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Try optimized parser forward loop
This commit is contained in:
		
							parent
							
								
									79fcf8576a
								
							
						
					
					
						commit
						f018f2030c
					
				| 
						 | 
				
			
			@ -16,7 +16,7 @@ cdef class Parser:
 | 
			
		|||
    cdef public object _multitasks
 | 
			
		||||
 | 
			
		||||
    cdef void _parse_step(self, StateC* state,
 | 
			
		||||
            const float* feat_weights,
 | 
			
		||||
            int nr_class, int nr_feat, int nr_piece) nogil
 | 
			
		||||
            const float* feat_weights, const float* hW, const float* hb,
 | 
			
		||||
            int nr_class, int nr_hidden, int nr_feat, int nr_piece) nogil
 | 
			
		||||
 | 
			
		||||
    #cdef int parseC(self, TokenC* tokens, int length, int nr_feat) nogil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -289,8 +289,6 @@ cdef class Parser:
 | 
			
		|||
                    zero_init(Affine(nr_class, hidden_width, drop_factor=0.0))
 | 
			
		||||
                )
 | 
			
		||||
                upper.is_noop = False
 | 
			
		||||
                print(upper._layers)
 | 
			
		||||
                print(upper._layers[0]._layers)
 | 
			
		||||
 | 
			
		||||
        # TODO: This is an unfortunate hack atm!
 | 
			
		||||
        # Used to set input dimensions in network.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,7 +148,8 @@ cdef class TransitionSystem:
 | 
			
		|||
 | 
			
		||||
    def add_action(self, int action, label_name):
 | 
			
		||||
        cdef attr_t label_id
 | 
			
		||||
        if not isinstance(label_name, (int, long)):
 | 
			
		||||
        if not isinstance(label_name, int) and \
 | 
			
		||||
        not isinstance(label_name, long):
 | 
			
		||||
            label_id = self.strings.add(label_name)
 | 
			
		||||
        else:
 | 
			
		||||
            label_id = label_name
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user