INNER CODE UNIT · Go
val
takara-ai/go-attention · cmd/demo/main.go:83
val := float64(i*j) / float64(config.DModel)
queries[i][j] = val
keys[i][j] = val
values[i][j] = val
}
}
// Process through multi-head attention
output, err := mha.Forward(queries, keys, values)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Input dimensions: [%d batches × %d tokens × %d features]\n",
batchSize, seqLen, config.DModel)
fmt.Printf("Output shape: [%d×%d]\n", len(output), len(output[0]))
fmt.Println("First few output values:", output[0][:4])
}