From 42ee72bf62a03cffc0d10bb691a1b011dfadccfa Mon Sep 17 00:00:00 2001 From: Jonas Knobloch Date: Mon, 6 Apr 2026 22:37:08 +0200 Subject: Access outputs by name --- gpt2/allocator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gpt2/allocator.go') diff --git a/gpt2/allocator.go b/gpt2/allocator.go index 30fb621..a3c7c26 100644 --- a/gpt2/allocator.go +++ b/gpt2/allocator.go @@ -256,6 +256,16 @@ func (a *Allocator) Outputs() ([]string, []ort.Value) { return a.outputNames, vals } +func (a *Allocator) Value(name string) ort.Value { + v, ok := a.values[name] + + if !ok { + panic("unknown value: " + name) + } + + return v +} + func (a *Allocator) inputIDs(tokens []int64, force bool) error { const name = "input_ids" -- cgit v1.3.1