mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-30 23:47:31 +03:00 
			
		
		
		
	Deal with generators in tuplify
This commit is contained in:
		
							parent
							
								
									a7d9c8156d
								
							
						
					
					
						commit
						0620820857
					
				|  | @ -70,6 +70,10 @@ def tuplify(layer1: Model, layer2: Model, *layers) -> Model: | |||
| def tuplify_forward(model, X, is_train): | ||||
|     Ys = [] | ||||
|     backprops = [] | ||||
|     # If the input is a generator we need to unroll it. | ||||
|     # The type check is necessary because arrays etc. are also OK. | ||||
|     if isinstance(X, Generator): | ||||
|         X = list(X) | ||||
|     for layer in model.layers: | ||||
|         Y, backprop = layer(X, is_train) | ||||
|         Ys.append(Y) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user