MCPcopy Create free account
hub / github.com/TabbyML/tabby / forward_batch

Method forward_batch

python/cpp/generator.cc:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 }
95
96 StorageView
97 forward_batch(const std::variant<BatchTokens, BatchIds, StorageView>& inputs,
98 const std::optional<StorageView>& lengths,
99 const bool return_log_probs) {
100 std::future<StorageView> future;
101
102 switch (inputs.index()) {
103 case 0:
104 future = _pool->forward_batch_async(std::get<BatchTokens>(inputs), return_log_probs);
105 break;
106 case 1:
107 future = _pool->forward_batch_async(std::get<BatchIds>(inputs), return_log_probs);
108 break;
109 case 2:
110 if (!lengths)
111 throw std::invalid_argument("lengths vector is required when passing a dense input");
112 future = _pool->forward_batch_async(std::get<StorageView>(inputs),
113 lengths.value(),
114 return_log_probs);
115 break;
116 }
117
118 return future.get();
119 }
120 };
121
122

Callers

nothing calls this directly

Calls 4

indexMethod · 0.80
forward_batch_asyncMethod · 0.45
valueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected