Skip to content

Commit 96c1091

Browse files
metascroymalfet
authored andcommitted
fix bugs in runner-et
1 parent 5aaf2dd commit 96c1091

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

runner-et/run.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <time.h>
88
#include <math.h>
99
#include <string.h>
10-
#include <iostream>
1110
#include <cassert>
11+
#include <iostream>
1212

1313
#include <executorch/extension/runner_util/managed_tensor.h>
1414
#include <executorch/runtime/core/exec_aten/exec_aten.h>
@@ -127,8 +127,7 @@ float* forward(Transformer* transformer, int token, int pos) {
127127

128128
#ifndef __KV_CACHE__
129129
// @lint-ignore CLANGTIDY facebook-hte-LocalUncheckedArrayBounds
130-
ManagedTensor tokens_managed(
131-
s->toks, sizeof(int64_t)*(pos+1), {1, pos+1}, ScalarType::Long);
130+
ManagedTensor tokens_managed(&(s->toks[pos]), /*ignored*/sizeof(int64_t)*(pos+1), {1, 1}, ScalarType::Long);
132131
#else
133132
ManagedTensor tokens_managed(
134133
token_buffer, sizeof(int64_t), {1, 1}, ScalarType::Long);
@@ -137,6 +136,7 @@ float* forward(Transformer* transformer, int token, int pos) {
137136
std::vector<EValue> inputs;
138137
auto tmp1 = EValue(tokens_managed.get_aliasing_tensor());
139138
auto tmp2 = EValue(pos_managed.get_aliasing_tensor());
139+
140140
inputs.push_back(tmp1);
141141
inputs.push_back(tmp2);
142142
Result<std::vector<EValue>> outputs_res = transformer->runner->forward(inputs);

0 commit comments

Comments
 (0)