From bc1a818fdce1f818e0ce84b543c191769df5abfe Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Fri, 17 Oct 2025 18:39:18 -0700 Subject: [PATCH] contiguous input per layer (#12686) Co-authored-by: Michael Yang --- model/models/gemma3n/model_text.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/models/gemma3n/model_text.go b/model/models/gemma3n/model_text.go index d0e9a026..1333151b 100644 --- a/model/models/gemma3n/model_text.go +++ b/model/models/gemma3n/model_text.go @@ -65,7 +65,7 @@ func (m *TextModel) Forward(ctx ml.Context, batch input.Batch, cache kvcache.Cac cache.(*kvcache.WrapperCache).SetLayerType(layerType) // inputPerLayer = inputsPerLayer[:, i, :] - inputPerLayer := inputsPerLayer.View(ctx, i*inputsPerLayer.Stride(1), inputsPerLayer.Dim(0), inputsPerLayer.Stride(2), inputsPerLayer.Dim(2)) + inputPerLayer := inputsPerLayer.View(ctx, i*inputsPerLayer.Stride(1), inputsPerLayer.Dim(0), inputsPerLayer.Stride(2), inputsPerLayer.Dim(2)).Contiguous(ctx) hiddenStates = layer.Forward(ctx, hiddenStates, inputPerLayer, positions, one, cache, i >= firstSharedKeyValue, ropeBase, float64(m.activationSparsityScale[i]), &m.TextOptions) }