text stringlengths 435 1.65k | prefix stringlengths 51 700 | middle stringlengths 10 200 | suffix stringlengths 50 700 | type stringclasses 2
values |
|---|---|---|---|---|
<fim_prefix> convert_weights_ak_to_gg(layer.wv , &w->wv[i*row_length*row_length/n_multiqueries]);
convert_weights_ak_to_gg(layer.w1 , &w->w1[i*row_length*n_ff]);
convert_weights_ak_to_gg(layer.w2 , &w->w2[i*n_ff*row_length]);
convert_weights_ak_to_gg(laye... | convert_weights_ak_to_gg(layer.wv , &w->wv[i*row_length*row_length/n_multiqueries]);
convert_weights_ak_to_gg(layer.w1 , &w->w1[i*row_length*n_ff]);
convert_weights_ak_to_gg(layer.w2 , &w->w2[i*n_ff*row_length]);
convert_weights_ak_to_gg(layer.w3 ... | tokens.push_back(token_data.text.c_str()); | scores.push_back(token_data.score);
token_types.push_back(token_data.type);
}
gguf_set_arr_str(ctx, KV_TOKENIZER_LIST, tokens.data(), tokens.size());
gguf_set_arr_data(ctx, KV_TOKENIZER_SCORES, GGUF_TYPE_FLOAT32, scores.data(), scores.size());
gguf_set_arr_data(ctx, KV_TOKENIZER_TOKEN_TY... | random |
<fim_prefix>:vector<llama_seq_id> seq_ids(n_parallel, 0);
for (int32_t i = 0; i < n_parallel; ++i) {
seq_ids[i] = i;
}
// evaluate the initial prompt
for (size_t i = 0; i < tokens_list.size(); ++i) {
common_batch_add(batch, tokens_list[i], i, seq_ids, false);
}
GGML_ASSERT(batch... | :vector<llama_seq_id> seq_ids(n_parallel, 0);
for (int32_t i = 0; i < n_parallel; ++i) {
seq_ids[i] = i;
}
// evaluate the initial prompt
for (size_t i = 0; i < tokens_list.size(); ++i) {
common_batch_add(batch, tokens_list[i], i, seq_ids, false);
}
GGML_ASSERT(batch.n_tokens ==... | llama_vocab_bos(vocab) | ;
}
common_batch_clear(batch);
common_batch_add(batch, decoder_start_token_id, 0, seq_ids, false);
}
// llama_decode will output logits only for the last token of the prompt
batch.logits[batch.n_tokens - 1] = true;
if (llama_decode(ctx, batch) != 0) {
LOG_ERR("%s: llam... | ast_based |
<fim_prefix> al_use_projection_transform(&last_projection_transform);
}
bool ImGui_ImplAllegro5_CreateDeviceObjects()
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
// Create an invisible mouse cursor
// Because al_hide_mouse_cursor() seems to mess up with the actual inputs..
... | al_use_projection_transform(&last_projection_transform);
}
bool ImGui_ImplAllegro5_CreateDeviceObjects()
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
// Create an invisible mouse cursor
// Because al_hide_mouse_cursor() seems to mess up with the actual inputs..
ALLEGRO_BITM... | //IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height); | IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
// Create texture
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = fa... | random |
<fim_prefix> RANGE_DATA(ST, src1_data, src1_step), src1_step, \
RANGE_DATA(DT, dst1_data, dst1_step), dst1_step, __VA_ARGS__)
#define TEGRA_UNARYOPSCALE(type, op, src1, sz1, dst, sz,... | RANGE_DATA(ST, src1_data, src1_step), src1_step, \
RANGE_DATA(DT, dst1_data, dst1_step), dst1_step, __VA_ARGS__)
#define TEGRA_UNARYOPSCALE(type, op, src1, sz1, dst, sz, w, h, scale... | TegraUnaryOpScale_Invoker(recipf, reciprocal, 1, scale) |
#undef cv_hal_mul8u
#define cv_hal_mul8u(src1, sz1, src2, sz2, dst, sz, w, h, scales) TEGRA_BINARYOPSCALE(CAROTENE_NS::u8, mul, src1, sz1, src2, sz2, dst, sz, w, h, scales)
#undef cv_hal_mul8s
#define cv_hal_mul8s(src1, sz1, src2, sz2, dst, sz, w, h, scales) TEGRA_BINARYOPSCALE(CAROTENE_NS::s8, mul, src1, sz1, src2, ... | ast_based |
<fim_prefix>EPLICATE;
break;
case CV_HAL_BORDER_REFLECT:
ctx->border = CAROTENE_NS::BORDER_MODE_REFLECT;
break;
case CV_HAL_BORDER_WRAP:
ctx->border = CAROTENE_NS::BORDER_MODE_WRAP;
break;
case CV_HAL_BORDER_REFLECT_101:
ctx->border = CAROTENE_NS::BORDER_MODE_... | EPLICATE;
break;
case CV_HAL_BORDER_REFLECT:
ctx->border = CAROTENE_NS::BORDER_MODE_REFLECT;
break;
case CV_HAL_BORDER_WRAP:
ctx->border = CAROTENE_NS::BORDER_MODE_WRAP;
break;
case CV_HAL_BORDER_REFLECT_101:
ctx->border = CAROTENE_NS::BORDER_MODE_REFLECT101;
... | ctx->kernelx_data[1]=kernelx_data[1] | ;
ctx->kernelx_data[2]=kernelx_data[2];
ctx->kernely_data[0]=kernely_data[0];
ctx->kernely_data[1]=kernely_data[1];
ctx->kernely_data[2]=kernely_data[2];
break;
case CV_8SC1:
ctx->kernelx_data[0]=((char*)kernelx_data)[0];
ctx->kernelx_data[1]=((char*)kernelx_d... | ast_based |
<fim_prefix> -> RefType { return values_.Get(id); }
// Returns a new block formed by applying `transform(elem_id)` to each element
// in the specified block.
template <typename TransformFnT>
auto Transform(IdT id, TransformFnT transform) -> IdT {
llvm::SmallVector<ElementType> block(llvm::map_range(Get(id)... | -> RefType { return values_.Get(id); }
// Returns a new block formed by applying `transform(elem_id)` to each element
// in the specified block.
template <typename TransformFnT>
auto Transform(IdT id, TransformFnT transform) -> IdT {
llvm::SmallVector<ElementType> block(llvm::map_range(Get(id), transform)... | result.key() | ;
}
// Promotes an existing block ID to a canonical block ID, or returns an
// existing canonical block ID if the block was already added. The specified
// block must not be modified after this point.
auto MakeCanonical(IdT id) -> IdT {
// Get the content first so that we don't have unnecessary translati... | ast_based |
<fim_prefix> size = size * nmemb;
auto *buf = reinterpret_cast<std::string *>(userp);
buf->append(reinterpret_cast<const char *>(contents), size);
return size;
}
#endif
// In the ideal scenario, Tesseract will start working on data as soon
// as it can. For example, if you stream a filelist through stdin, we
//... | size = size * nmemb;
auto *buf = reinterpret_cast<std::string *>(userp);
buf->append(reinterpret_cast<const char *>(contents), size);
return size;
}
#endif
// In the ideal scenario, Tesseract will start working on data as soon
// as it can. For example, if you stream a filelist through stdin, we
// should star... | // impractical. So we support a command line flag to explicitly
// identify the scenario that really matters: filelists on | // stdin. We'll still do our best if the user likes pipes.
bool TessBaseAPI::ProcessPagesInternal(const char *filename, const char *retry_config,
int timeout_millisec, TessResultRenderer *renderer) {
bool stdInput = !strcmp(filename, "stdin") || !strcmp(filename, "-");
if (std... | random |
<fim_prefix>(curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
}
curlcode = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
if (curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
curlcode = curl_easy_setopt(curl, CURLOPT_WRIT... | (curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
}
curlcode = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
if (curlcode != CURLE_OK) {
return error("curl_easy_setopt");
}
curlcode = curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buf)... | curl_easy_cleanup(curl) | ;
data = reinterpret_cast<const l_uint8 *>(buf.data());
}
#else
fprintf(stderr, "Error, this tesseract has no URL support\n");
return false;
#endif
} else {
// Check whether the input file can be read.
if (FILE *file = fopen(filename, "rb")) {
fclose(file);
} else {
fprintf(s... | ast_based |
<fim_prefix>}
void Engine::get_singletons(List<Singleton> *p_singletons) {
for (const Singleton &E : singletons) {
#ifdef TOOLS_ENABLED
if (!is_editor_hint() && E.editor_only) {
continue;
}
#endif
p_singletons->push_back(E);
}
}
String Engine::get_write_movie_path() const {
return write_movie_path;
}
vo... | }
void Engine::get_singletons(List<Singleton> *p_singletons) {
for (const Singleton &E : singletons) {
#ifdef TOOLS_ENABLED
if (!is_editor_hint() && E.editor_only) {
continue;
}
#endif
p_singletons->push_back(E);
}
}
String Engine::get_write_movie_path() const {
return write_movie_path;
}
void Engine::s... | return server_syncs > SERVER_SYNC_FRAME_COUNT_WARNING;
}
void Engine::set_freeze_time_scale(bool p_frozen) { | freeze_time_scale = p_frozen;
}
void Engine::set_embedded_in_editor(bool p_enabled) {
embedded_in_editor = p_enabled;
}
bool Engine::is_embedded_in_editor() const {
return embedded_in_editor;
}
Engine::Engine() {
singleton = this;
}
Engine::~Engine() {
if (singleton == this) {
singleton = nullptr;
}
}
Engi... | random |
<fim_prefix>ressed() && !mb->is_shift_pressed() && !mb->is_command_or_control_pressed();
if (mb->is_double_click() && !moving_selection && no_mod_key_pressed) {
int x = pos.x - timeline->get_name_limit();
float ofs = x / timeline->get_zoom_scale() + timeline->get_value();
emit_signal(SNAME("timeline_changed"... | ressed() && !mb->is_shift_pressed() && !mb->is_command_or_control_pressed();
if (mb->is_double_click() && !moving_selection && no_mod_key_pressed) {
int x = pos.x - timeline->get_name_limit();
float ofs = x / timeline->get_zoom_scale() + timeline->get_value();
emit_signal(SNAME("timeline_changed"), ofs, fals... | RBMap<int, Rect2> track_icons = E.value; |
for (const KeyValue<int, Rect2> &I : track_icons) {
if (I.value.has_point(mb->get_position())) {
if (I.key == REMOVE_ICON) {
if (!read_only) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action("Remove Bezier Track", UndoRedo::MERGE_DISAB... | ast_based |
<fim_prefix>( \
depth == CV_8U && CAROTENE_NS::isSupportedConfiguration() ? \
scn == 3 ? \
(swapBlue ? \
parallel_for_(cv::Range(0, height), \
TegraCvtColor_rgb2gray_Invoker(src_data, src_step, dst_data, dst_step, width, height), \
(width * height)... | ( \
depth == CV_8U && CAROTENE_NS::isSupportedConfiguration() ? \
scn == 3 ? \
(swapBlue ? \
parallel_for_(cv::Range(0, height), \
TegraCvtColor_rgb2gray_Invoker(src_data, src_step, dst_data, dst_step, width, height), \
(width * height) / static_ca... | scn == 4 ? \ | (swapBlue ? \
parallel_for_(cv::Range(0, height), \
TegraCvtColor_rgbx2gray_Invoker(src_data, src_step, dst_data, dst_step, width, height), \
(width * height) / static_cast<double>(1<<16)) : \
parallel_for_(cv::Range(0, height), \
... | random |
<fim_prefix>get_relative());
mouse_event_info.pos = p_event_pos;
hover_prev_pos = p_event_pos;
}
ev->set_button_mask(event_buttons_mask);
ev->set_pressure(p_pressure);
ev->set_tilt(p_tilt);
Input::get_singleton()->parse_input_event(ev);
} break;
case AMOTION_EVENT_ACTION_SCROLL: {
Ref<Inp... | get_relative());
mouse_event_info.pos = p_event_pos;
hover_prev_pos = p_event_pos;
}
ev->set_button_mask(event_buttons_mask);
ev->set_pressure(p_pressure);
ev->set_tilt(p_tilt);
Input::get_singleton()->parse_input_event(ev);
} break;
case AMOTION_EVENT_ACTION_SCROLL: {
Ref<InputEventMouse... | _wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_UP, p_delta.y) | ;
} else if (p_delta.y < 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_DOWN, -p_delta.y);
}
if (p_delta.x > 0) {
_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_RIGHT, p_delta.x);
} else if (p_delta.x < 0) {
_wheel_button_click(event_buttons_mask, ev, MouseB... | ast_based |
<fim_prefix>ng(rect_width_);
tsv_str += "\t" + std::to_string(rect_height_);
tsv_str += "\t-1\t\n";
const std::unique_ptr</*non-const*/ ResultIterator> res_it(GetIterator());
while (!res_it->Empty(RIL_BLOCK)) {
if (res_it->Empty(RIL_WORD)) {
res_it->Next(RIL_WORD);
continue;
}
// Add r... | ng(rect_width_);
tsv_str += "\t" + std::to_string(rect_height_);
tsv_str += "\t-1\t\n";
const std::unique_ptr</*non-const*/ ResultIterator> res_it(GetIterator());
while (!res_it->Empty(RIL_BLOCK)) {
if (res_it->Empty(RIL_WORD)) {
res_it->Next(RIL_WORD);
continue;
}
// Add rows for any ... | tsv_str += "\t" + std::to_string(word_num) | ;
AddBoxToTSV(res_it.get(), RIL_BLOCK, tsv_str);
tsv_str += "\t-1\t\n"; // end of row for block
}
if (res_it->IsAtBeginningOf(RIL_PARA)) {
par_num++;
line_num = 0;
word_num = 0;
tsv_str += "3\t" + std::to_string(page_num); // level 3 - paragraph
tsv_str += "\t" + std::t... | ast_based |
<fim_prefix> if (p_ofs_valid) {
if (editor->snap_keys->is_pressed() && editor->step->get_value() != 0) {
insert_pos = editor->snap_time(insert_pos);
}
}
float dst_time = key.time + insert_pos;
int existing_idx = animation->track_find_key(selected_track, dst_time, Animation::FIND_MODE_APPROX);
... | if (p_ofs_valid) {
if (editor->snap_keys->is_pressed() && editor->step->get_value() != 0) {
insert_pos = editor->snap_time(insert_pos);
}
}
float dst_time = key.time + insert_pos;
int existing_idx = animation->track_find_key(selected_track, dst_time, Animation::FIND_MODE_APPROX);
Variant v... | Pair<int, float> p;
p.first = selected_track;
p.second = dst_time;
new_selection_values.push_back(p); |
if (existing_idx != -1) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", selected_track, dst_time, animation->track_get_key_value(selected_track, existing_idx), animation->track_get_key_transition(selected_track, existing_idx));
}
}
undo_redo->add_do_method(this, "_clear_selection_for_a... | random |
<fim_prefix> LOG_INF("%s: n_ctx: %u\n", __func__, params->n_ctx);
LOG_INF("%s: n_embd: %u\n", __func__, params->n_embd);
LOG_INF("%s: n_mult: %u\n", __func__, params->n_mult);
LOG_INF("%s: n_head: %u\n", __func__, params->n_head);
LOG_INF("%s: n_head_kv: %u\n", __func__, params->n_head_k... | LOG_INF("%s: n_ctx: %u\n", __func__, params->n_ctx);
LOG_INF("%s: n_embd: %u\n", __func__, params->n_embd);
LOG_INF("%s: n_mult: %u\n", __func__, params->n_mult);
LOG_INF("%s: n_head: %u\n", __func__, params->n_head);
LOG_INF("%s: n_head_kv: %u\n", __func__, params->n_head_kv);
LOG_... | LOG_INF("%s: Allocating ", __func__);
int64_t total = 1;
int i = 0;
for (; i < ggml_n_dims(t); ++i) { | if (i > 0) { LOG_INF("x "); }
LOG_INF("[%" PRId64 "] ", t->ne[i]);
total *= t->ne[i];
}
if (i > 1) { LOG_INF("= [%" PRId64 "] ", total); }
LOG_INF("float space for %s\n", ggml_get_name(t));
}
}
static void init_model(struct my_llama_model * model) {
c... | random |
<fim_prefix>ntSession(scope, "") {}
ClientSession::ClientSession(const Scope& scope,
const SessionOptions& session_options) {
Session* new_session;
absl::Status status = NewSession(session_options, &new_session);
TF_CHECK_OK(status) << status;
impl_.reset(new Impl(new_session, scop... | ntSession(scope, "") {}
ClientSession::ClientSession(const Scope& scope,
const SessionOptions& session_options) {
Session* new_session;
absl::Status status = NewSession(session_options, &new_session);
TF_CHECK_OK(status) << status;
impl_.reset(new Impl(new_session, scope.graph_as_s... | SessionOptions options;
options.env = Env::Default();
options.target = target; |
return options;
}
absl::Status ClientSession::Run(const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const {
return Run(FeedType{}, fetch_outputs, {}, outputs);
}
absl::Status ClientSession::Run(const FeedType& inputs,
const std... | ast_based |
<fim_prefix>#pragma once
#include <filesystem>
#include <stdexcept>
#include <string>
#include <utility>
namespace fs = std::filesystem;
class Dlhandle {
void *chandle = nullptr;
public:
class Exception : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
D... | #pragma once
#include <filesystem>
#include <stdexcept>
#include <string>
#include <utility>
namespace fs = std::filesystem;
class Dlhandle {
void *chandle = nullptr;
public:
class Exception : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
Dlhandle() = ... | Dlhandle(const Dlhandle &o) = delete; | Dlhandle(Dlhandle &&o)
: chandle(o.chandle)
{
o.chandle = nullptr;
}
~Dlhandle();
Dlhandle &operator=(Dlhandle &&o) {
chandle = std::exchange(o.chandle, nullptr);
return *this;
}
template <typename T>
T *get(const std::string &symbol) const {
re... | random |
<fim_prefix>n, frame);
}
if (t.is_null()) {
return Rect2();
}
Size2 s = t->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;
}
if (s == Size2(0, 0)) {
s = Size2(1, 1);
}
return Rect2(ofs, s);
}
void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
if (frames.is_nu... | n, frame);
}
if (t.is_null()) {
return Rect2();
}
Size2 s = t->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;
}
if (s == Size2(0, 0)) {
s = Size2(1, 1);
}
return Rect2(ofs, s);
}
void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
if (frames.is_null()) {
re... | bool is_first_element = true; |
for (const StringName &E : names) {
if (!is_first_element) {
p_property.hint_string += ",";
} else {
is_first_element = false;
}
p_property.hint_string += String(E);
if (animation == E) {
current_found = true;
}
}
if (!current_found) {
if (p_property.hint_string.is_empty()) {
... | ast_based |
<fim_prefix> Run(grpc_completion_queue_functor* cb, int) {
auto* callback = static_cast<ShutdownCallback*>(cb);
delete callback->cq_;
delete callback;
}
private:
grpc::CompletionQueue* cq_ = nullptr;
};
} // namespace
::grpc::CompletionQueue* Channel::CallbackCQ() {
// TODO(vjpai): Consider using ... | Run(grpc_completion_queue_functor* cb, int) {
auto* callback = static_cast<ShutdownCallback*>(cb);
delete callback->cq_;
delete callback;
}
private:
grpc::CompletionQueue* cq_ = nullptr;
};
} // namespace
::grpc::CompletionQueue* Channel::CallbackCQ() {
// TODO(vjpai): Consider using a single glo... | callback_cq_.load(std::memory_order_relaxed) | ;
if (callback_cq == nullptr) {
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
auto* shutdown_callback = new ShutdownCallback;
callback_cq = new grpc::CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, G... | ast_based |
<fim_prefix>// stdin. We'll still do our best if the user likes pipes.
bool TessBaseAPI::ProcessPagesInternal(const char *filename, const char *retry_config,
int timeout_millisec, TessResultRenderer *renderer) {
bool stdInput = !strcmp(filename, "stdin") || !strcmp(filename, "-"... | // stdin. We'll still do our best if the user likes pipes.
bool TessBaseAPI::ProcessPagesInternal(const char *filename, const char *retry_config,
int timeout_millisec, TessResultRenderer *renderer) {
bool stdInput = !strcmp(filename, "stdin") || !strcmp(filename, "-");
if (std... | // At this point we are officially in autodection territory. | // That means any data in stdin must be buffered, to make it
// seekable.
std::string buf;
const l_uint8 *data = nullptr;
if (stdInput) {
buf.assign((std::istreambuf_iterator<char>(std::cin)), (std::istreambuf_iterator<char>()));
data = reinterpret_cast<const l_uint8 *>(buf.data());
} else if (strst... | random |
<fim_prefix>/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
... | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE ... | #include "core/version.h" | #include "servers/rendering/rendering_device.h"
void Engine::set_physics_ticks_per_second(int p_ips) {
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
ips = p_ips;
}
int Engine::get_physics_ticks_per_second() const {
return ips;
}
void Engine::set_max_physics_steps_per_frame... | random |
<fim_prefix> if (!block_it.data()->pdblk.poly_block()->IsText()) {
continue;
}
++num_blocks;
}
if (!num_blocks) {
tprintf("WARNING: Found no blocks\n");
return;
}
*block_orientation = new int[num_blocks];
*vertical_writing = new bool[num_blocks];
block_it.move_to_first();
int i = ... | if (!block_it.data()->pdblk.poly_block()->IsText()) {
continue;
}
++num_blocks;
}
if (!num_blocks) {
tprintf("WARNING: Found no blocks\n");
return;
}
*block_orientation = new int[num_blocks];
*vertical_writing = new bool[num_blocks];
block_it.move_to_first();
int i = 0;
for (bl... | double rot_theta = -(re_theta - classify_theta) * 2.0 / M_PI;
if (rot_theta < 0) {
rot_theta += 4; | }
int num_rotations = static_cast<int>(rot_theta + 0.5);
(*block_orientation)[i] = num_rotations;
// The classify_rotation is non-zero only if the text has vertical
// writing direction.
(*vertical_writing)[i] = classify_rotation.y() != 0.0f;
++i;
}
}
void TessBaseAPI::DetectParagraphs(bo... | random |
<fim_prefix>x));
}
}
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// Reselect pasted.
int i = 0;
for (const Pair<int, float> &E : new_selection_values) {
undo_redo->add_do_method(this, "_select_at_an... | x));
}
}
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// Reselect pasted.
int i = 0;
for (const Pair<int, float> &E : new_selection_values) {
undo_redo->add_do_method(this, "_select_at_anim", animati... | undo_redo->add_do_method(ape, "_animation_update_key_frame") | ;
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
}
undo_redo->add_do_method(this, "queue_redraw");
undo_redo->add_undo_method(this, "queue_redraw");
undo_redo->commit_action();
}
}
void AnimationBezierTrackEdit::delete_selection() {
if (selection.size()) {
EditorUndoRedoManager *undo_r... | ast_based |
<fim_prefix>lic std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
class UnsupportedModelError: public std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
struct GPUDevice {
const char *backend;
int index;
int t... | lic std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
class UnsupportedModelError: public std::runtime_error {
public:
using std::runtime_error::runtime_error;
};
struct GPUDevice {
const char *backend;
int index;
int type;
... | {
assert(backend == "cuda"s || backend == "kompute"s);
return backendName() + ": " + name;
} |
std::string backendName() const { return backendIdToName(backend); }
static std::string backendIdToName(const std::string &backend) { return s_backendNames.at(backend); }
static std::string updateSelectionName(const std::string &name) {
if (name == "Auto" || name == "CPU" || name... | ast_based |
<fim_prefix>/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifdef ACCESSKIT_ENABLED
#include "accessibility_driver_accesskit.h"
#include "core/config/project_settings.h"
#include "core/version.h"
#include "ser... | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifdef ACCESSKIT_ENABLED
#include "accessibility_driver_accesskit.h"
#include "core/config/project_settings.h"
#include "core/version.h"
#include "servers/text_se... |
_FORCE_INLINE_ accesskit_action AccessibilityDriverAccessKit::_accessibility_action(DisplayServer::AccessibilityAction p_action) const { | if (action_map.has(p_action)) {
return action_map[p_action];
}
return ACCESSKIT_ACTION_CLICK;
}
bool AccessibilityDriverAccessKit::window_create(DisplayServer::WindowID p_window_id, void *p_handle) {
ERR_FAIL_COND_V(windows.has(p_window_id), false);
WindowData &wd = windows[p_window_id];
AccessibilityElement... | random |
<fim_prefix>_rect.position + Vector2(-inner_ofs, selection_rect.size.height + inner_ofs), accent, limit, right_limit);
_draw_line_clipped(selection_rect.position + Vector2(selection_rect.size.width + inner_ofs, -inner_ofs), selection_rect.position + selection_rect.size + Vector2(inner_ofs, inner_ofs), accent, limi... | _rect.position + Vector2(-inner_ofs, selection_rect.size.height + inner_ofs), accent, limit, right_limit);
_draw_line_clipped(selection_rect.position + Vector2(selection_rect.size.width + inner_ofs, -inner_ofs), selection_rect.position + selection_rect.size + Vector2(inner_ofs, inner_ofs), accent, limit, right_lim... | if (bs_from.y > bs_to.y) {
SWAP(bs_from.y, bs_to.y);
} |
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_selection_fill_color"), EditorStringName(Editor)));
draw_rect(
Rect2(bs_from, bs_to - bs_from),
get_theme_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor)),
false,
Math::round(EDSCALE))... | ast_based |
<fim_prefix>(0, SEEK_SET);
}
}
size_t tell() const {
#ifdef _WIN32
__int64 ret = _ftelli64(fp);
#else
long ret = std::ftell(fp);
#endif
GGML_ASSERT(ret != -1); // this really shouldn't fail
return (size_t) ret;
}
void seek(size_t offset, int whence) {
#ifdef _WI... | (0, SEEK_SET);
}
}
size_t tell() const {
#ifdef _WIN32
__int64 ret = _ftelli64(fp);
#else
long ret = std::ftell(fp);
#endif
GGML_ASSERT(ret != -1); // this really shouldn't fail
return (size_t) ret;
}
void seek(size_t offset, int whence) {
#ifdef _WIN32
... | die_fmt("fread failed: %s", strerror(errno)) | ;
}
if (ret != 1) {
die("unexpectedly reached end of file");
}
}
std::uint32_t read_u32() {
std::uint32_t ret;
read_raw(&ret, sizeof(ret));
return ret;
}
std::float_t read_f32() {
std::float_t ret;
read_raw(&ret, sizeof(ret));
... | ast_based |
<fim_prefix>oid DeserializeFileDB(const fs::path& path, Data&& data)
{
FILE* file = fsbridge::fopen(path, "rb");
AutoFile filein{file};
if (filein.IsNull()) {
throw DbNotFoundError{};
}
DeserializeDB(filein, data);
}
} // namespace
CBanDB::CBanDB(fs::path ban_list_path)
: m_banlist_dat(... | oid DeserializeFileDB(const fs::path& path, Data&& data)
{
FILE* file = fsbridge::fopen(path, "rb");
AutoFile filein{file};
if (filein.IsNull()) {
throw DbNotFoundError{};
}
DeserializeDB(filein, data);
}
} // namespace
CBanDB::CBanDB(fs::path ban_list_path)
: m_banlist_dat(ban_list_pat... | banmap_t& banSet | )
{
if (fs::exists(m_banlist_dat)) {
LogWarning("banlist.dat ignored because it can only be read by " CLIENT_NAME " version 22.x. Remove %s to silence this warning.", fs::quoted(fs::PathToString(m_banlist_dat)));
}
// If the JSON banlist does not exist, then recreate it
if (!fs::exists(m_banlist... | ast_based |
<fim_prefix> mCalibData->cameraMatrix.at<double>(0,0) =
mCalibData->cameraMatrix.at<double>(1,1);
}
}
if(!(mCalibFlags & cv::CALIB_ZERO_TANGENT_DIST)) {
const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(2)) < e... | mCalibData->cameraMatrix.at<double>(0,0) =
mCalibData->cameraMatrix.at<double>(1,1);
}
}
if(!(mCalibFlags & cv::CALIB_ZERO_TANGENT_DIST)) {
const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(2)) < eps &&
... | }
if(!(mCalibFlags & cv::CALIB_FIX_K2)) {
const double eps = 0.005; | if(fabs(mCalibData->distCoeffs.at<double>(1)) < eps)
mCalibFlags |= cv::CALIB_FIX_K2;
}
if(!(mCalibFlags & cv::CALIB_FIX_K3)) {
const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(4)) < eps)
mCalibFlags |= cv::CALIB_FIX... | random |
<fim_prefix>buft_override {
const char * pattern;
ggml_backend_buffer_type_t buft;
};
struct llama_model_params {
// NULL-terminated list of devices to use for offloading (if NULL, all available devices are used)
ggml_backend_dev_t * devices;
// NULL-terminated list of ... | buft_override {
const char * pattern;
ggml_backend_buffer_type_t buft;
};
struct llama_model_params {
// NULL-terminated list of devices to use for offloading (if NULL, all available devices are used)
ggml_backend_dev_t * devices;
// NULL-terminated list of buffer types... | int32_t main_gpu; |
// proportion of the model (layers or rows) to offload to each GPU, size: llama_max_devices()
const float * tensor_split;
// Called with a progress value between 0.0 and 1.0. Pass NULL to disable.
// If the provided progress_callback returns true, model loading continues.
// I... | ast_based |
<fim_prefix> nullptr, 0, nullptr, nullptr, false, &mgr) == 0) {
osd_tess = osd_tesseract_;
osd_tesseract_->set_source_resolution(thresholder_->GetSourceYResolution());
} else {
tprintf(
"Warning: Auto orientation and script detecti... | nullptr, 0, nullptr, nullptr, false, &mgr) == 0) {
osd_tess = osd_tesseract_;
osd_tesseract_->set_source_resolution(thresholder_->GetSourceYResolution());
} else {
tprintf(
"Warning: Auto orientation and script detection requested... | tesseract_->PrepareForTessOCR(block_list_, osd_tess, &osr) | ;
return 0;
}
/**
* Return average gradient of lines on page.
*/
float TessBaseAPI::GetGradient() {
return tesseract_->gradient();
}
/** Delete the pageres and clear the block list ready for a new page. */
void TessBaseAPI::ClearResults() {
if (tesseract_ != nullptr) {
tesseract_->Clear();
}
delete pa... | ast_based |
<fim_prefix> type = LLAMA_TOKEN_TYPE_CONTROL;
} else if (text.empty()) {
type = LLAMA_TOKEN_TYPE_CONTROL;
} else if (sscanf(text.c_str(), "<0x%02hhX>", &byte_val) == 1) {
// Text of byte tokens is already in the expected format.
type... | type = LLAMA_TOKEN_TYPE_CONTROL;
} else if (text.empty()) {
type = LLAMA_TOKEN_TYPE_CONTROL;
} else if (sscanf(text.c_str(), "<0x%02hhX>", &byte_val) == 1) {
// Text of byte tokens is already in the expected format.
type = LLAMA_TOK... | }
static void convert_weights_ak_to_gg(struct ggml_tensor * gg_weights, const float * karpathy_weights) {
int size = 1;
for (int dim = 0; dim < ggml_n_dims(gg_weights); ++dim) { | size *= gg_weights->ne[dim];
}
for (int ct = 0; ct < size; ++ct) {
int64_t i0 = 0; int64_t i1 = 0;
int64_t i2 = 0; int64_t i3 = 0;
ggml_unravel_index(gg_weights, ct, &i0, &i1, &i2, &i3);
ggml_set_f32_nd(gg_weights, i0, i1, i2, i3, karpathy_weights[ct]);
}
}
static vo... | random |
<fim_prefix> if (vflip) {
dst_rect.size.y = -dst_rect.size.y;
}
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
} break;
}
}
void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
if (frames == p_frames) {
return;
}
if ... | if (vflip) {
dst_rect.size.y = -dst_rect.size.y;
}
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
} break;
}
}
void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
if (frames == p_frames) {
return;
}
if (frames.is_v... | autoplay = String() | ;
} else {
if (!frames->has_animation(animation)) {
set_animation(al.front()->get());
}
if (!frames->has_animation(autoplay)) {
autoplay = String();
}
}
}
notify_property_list_changed();
queue_redraw();
update_configuration_warnings();
emit_signal("sprite_frames_changed");
}
Ref<SpriteFra... | ast_based |
<fim_prefix> float penalty_present); // 0.0 = disabled
/// @details DRY sampler, designed by p-e-w, as described in: https://github.com/oobabooga/text-generation-webui/pull/5677, porting Koboldcpp implementation authored by pi6am: https://github.com/LostRuins/koboldcpp/pull/982
... | float penalty_present); // 0.0 = disabled
/// @details DRY sampler, designed by p-e-w, as described in: https://github.com/oobabooga/text-generation-webui/pull/5677, porting Koboldcpp implementation authored by pi6am: https://github.com/LostRuins/koboldcpp/pull/982
LLAMA_API s... | const char ** seq_breakers,
size_t num_breakers);
| LLAMA_API struct llama_sampler * llama_sampler_init_logit_bias(
int32_t n_vocab,
int32_t n_logit_bias,
const llama_logit_bias * logit_bias);
// this sampler is meant to be used for fill-in-the-middle infilling
// it's supposed to b... | random |
<fim_prefix> for (auto const& output : run_outputs) {
target_node_names.push_back(output.node()->name());
}
TF_RETURN_IF_ERROR(impl()->MaybeExtendGraph());
return impl()->session_->Run(run_options, feeds, output_tensor_names,
target_node_names, outputs, run_metadata);
}
absl::S... | for (auto const& output : run_outputs) {
target_node_names.push_back(output.node()->name());
}
TF_RETURN_IF_ERROR(impl()->MaybeExtendGraph());
return impl()->session_->Run(run_options, feeds, output_tensor_names,
target_node_names, outputs, run_metadata);
}
absl::Status Client... | TF_RETURN_IF_ERROR(feed.second.status) | ;
feeds.emplace_back(feed.first.name(), feed.second.tensor);
}
std::vector<string> output_tensor_names;
output_tensor_names.reserve(fetch_outputs.size());
for (auto const& output : fetch_outputs) {
output_tensor_names.push_back(output.name());
}
std::vector<string> target_node_names;
target_node_n... | ast_based |
<fim_prefix>o_string(line_num);
tsv_str += "\t" + std::to_string(word_num);
tsv_str += "\t" + std::to_string(left);
tsv_str += "\t" + std::to_string(top);
tsv_str += "\t" + std::to_string(right - left);
tsv_str += "\t" + std::to_string(bottom - top);
tsv_str += "\t" + std::to_string(res_it->Conf... | o_string(line_num);
tsv_str += "\t" + std::to_string(word_num);
tsv_str += "\t" + std::to_string(left);
tsv_str += "\t" + std::to_string(top);
tsv_str += "\t" + std::to_string(right - left);
tsv_str += "\t" + std::to_string(bottom - top);
tsv_str += "\t" + std::to_string(res_it->Confidence(RIL_W... | std::unique_ptr<const char[]>(res_it->GetUTF8Text(RIL_SYMBOL)) | .get();
res_it->Next(RIL_SYMBOL);
} while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
tsv_str += "\n"; // end of row
#if !defined(NDEBUG)
wcnt++;
#endif
}
return copy_string(tsv_str);
}
/** The 5 numbers output for each box (the usual 4 and a page number.) */
const int kNu... | ast_based |
<fim_prefix>sion_reloading = false;
bool embedded_in_editor = false;
bool recovery_mode_hint = false;
bool _print_header = true;
static inline Engine *singleton = nullptr;
String write_movie_path;
String shader_cache_path;
static constexpr int SERVER_SYNC_FRAME_COUNT_WARNING = 5;
int server_syncs = 0;
bool... | sion_reloading = false;
bool embedded_in_editor = false;
bool recovery_mode_hint = false;
bool _print_header = true;
static inline Engine *singleton = nullptr;
String write_movie_path;
String shader_cache_path;
static constexpr int SERVER_SYNC_FRAME_COUNT_WARNING = 5;
int server_syncs = 0;
bool frame_serve... | double get_physics_jitter_fix() const; |
virtual void set_max_fps(int p_fps);
virtual int get_max_fps() const;
virtual void set_audio_output_latency(int p_msec);
virtual int get_audio_output_latency() const;
virtual double get_frames_per_second() const { return _fps; }
uint64_t get_frames_drawn();
uint64_t get_physics_frames() const { return _phy... | ast_based |
<fim_prefix> LLAMA_FTYPE_MOSTLY_Q2_K = 10, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_S = 11, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_M = 12, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_L = 13, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q4_K_S ... | LLAMA_FTYPE_MOSTLY_Q2_K = 10, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_S = 11, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_M = 12, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q3_K_L = 13, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q4_K_S = 14, /... | LLAMA_FTYPE_MOSTLY_IQ2_XS = 20, // except 1d tensors
LLAMA_FTYPE_MOSTLY_Q2_K_S = 21, // except 1d tensors | LLAMA_FTYPE_MOSTLY_IQ3_XS = 22, // except 1d tensors
LLAMA_FTYPE_MOSTLY_IQ3_XXS = 23, // except 1d tensors
LLAMA_FTYPE_MOSTLY_IQ1_S = 24, // except 1d tensors
LLAMA_FTYPE_MOSTLY_IQ4_NL = 25, // except 1d tensors
LLAMA_FTYPE_MOSTLY_IQ3_S = 26, /... | random |
<fim_prefix>track_key_pair.second, p_mode, p_auto ? Animation::HANDLE_SET_MODE_AUTO : Animation::HANDLE_SET_MODE_RESET);
}
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
if (ape) {
undo_redo->add_do_method(ape, "_animation_update_key_frame");
undo_redo->add_undo_method(ape, "_animation_upda... | track_key_pair.second, p_mode, p_auto ? Animation::HANDLE_SET_MODE_AUTO : Animation::HANDLE_SET_MODE_RESET);
}
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
if (ape) {
undo_redo->add_do_method(ape, "_animation_update_key_frame");
undo_redo->add_undo_method(ape, "_animation_update_key_frame... | {
return;
} |
int idx = animation->track_find_key(p_track, p_pos, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(idx < 0);
selection.insert(IntPair(p_track, idx));
emit_signal(SNAME("select_key"), idx, p_single, p_track);
queue_redraw();
}
void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_CON... | ast_based |
<fim_prefix> bool use_validation_layers = false;
bool generate_spirv_debug_info = false;
bool extra_gpu_memory_tracking = false;
#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool accurate_breadcrumbs = false;
#endif
int32_t gpu_idx = -1;
uint64_t _process_frames = 0;
bool _in_physics = false;
List<Single... | bool use_validation_layers = false;
bool generate_spirv_debug_info = false;
bool extra_gpu_memory_tracking = false;
#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool accurate_breadcrumbs = false;
#endif
int32_t gpu_idx = -1;
uint64_t _process_frames = 0;
bool _in_physics = false;
List<Singleton> singlet... |
static constexpr int SERVER_SYNC_FRAME_COUNT_WARNING = 5;
int server_syncs = 0; | bool frame_server_synced = false;
bool freeze_time_scale = false;
public:
static Engine *get_singleton();
virtual void set_physics_ticks_per_second(int p_ips);
virtual int get_physics_ticks_per_second() const;
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
virtual int get_max_physics_... | random |
<fim_prefix>HDR;
} else {
target_format = Image::FORMAT_ASTC_4x4;
}
} else if (p_format == Image::ASTCFormat::ASTC_FORMAT_8x8) {
if (is_hdr) {
target_format = Image::FORMAT_ASTC_8x8_HDR;
} else {
target_format = Image::FORMAT_ASTC_8x8;
}
block_x = 8;
block_y = 8;
}
// Compress image data and ... | HDR;
} else {
target_format = Image::FORMAT_ASTC_4x4;
}
} else if (p_format == Image::ASTCFormat::ASTC_FORMAT_8x8) {
if (is_hdr) {
target_format = Image::FORMAT_ASTC_8x8_HDR;
} else {
target_format = Image::FORMAT_ASTC_8x8;
}
block_x = 8;
block_y = 8;
}
// Compress image data and (if required... | {
// Resize texture to fit block size.
r_img->resize(required_width, required_height);
width = required_width; |
height = required_height;
}
print_verbose(vformat("astcenc: Encoding image size %dx%d to format %s%s.", width, height, Image::get_format_name(target_format), has_mipmaps ? ", with mipmaps" : ""));
// Initialize astcenc.
const int64_t dest_size = Image::get_image_data_size(width, height, target_format, has_mipm... | ast_based |
<fim_prefix> return shader_cache_path;
}
Engine *Engine::get_singleton() {
return singleton;
}
bool Engine::notify_frame_server_synced() {
frame_server_synced = true;
return server_syncs > SERVER_SYNC_FRAME_COUNT_WARNING;
}
void Engine::set_freeze_time_scale(bool p_frozen) {
freeze_time_scale = p_frozen;
}
void... | return shader_cache_path;
}
Engine *Engine::get_singleton() {
return singleton;
}
bool Engine::notify_frame_server_synced() {
frame_server_synced = true;
return server_syncs > SERVER_SYNC_FRAME_COUNT_WARNING;
}
void Engine::set_freeze_time_scale(bool p_frozen) {
freeze_time_scale = p_frozen;
}
void Engine::set... | name(p_name),
ptr(p_ptr),
class_name(p_class_name) { | #ifdef DEBUG_ENABLED
RefCounted *rc = Object::cast_to<RefCounted>(p_ptr);
if (rc && !rc->is_referenced()) {
WARN_PRINT("You must use Ref<> to ensure the lifetime of a RefCounted object intended to be used as a singleton.");
}
#endif
}
| random |
<fim_prefix>_modes.end(); ++restore_itr, ++handle_itr) {
const AnimMoveRestore &amr = *restore_itr;
Array key = amr.key;
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
undo_redo->add_undo_method(
this,
"_bezier_track_insert_key_at_anim",
... | _modes.end(); ++restore_itr, ++handle_itr) {
const AnimMoveRestore &amr = *restore_itr;
Array key = amr.key;
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
undo_redo->add_undo_method(
this,
"_bezier_track_insert_key_at_anim",
animation... | E = E->prev() | ) {
real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second);
real_t newpos = animation->track_get_key_time(E->get().first, E->get().second);
newpos += -scaling_selection_offset.x + (newpos - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
undo_redo->add_do_method(th... | ast_based |
<fim_prefix>CCESSIBILITY_UPDATE notification.");
if (p_id.is_valid() && rid_owner.owns(p_id)) {
focus = p_id;
} else {
focus = RID();
}
}
RID AccessibilityDriverAccessKit::accessibility_get_window_root(DisplayServer::WindowID p_window_id) const {
const WindowData *wd = windows.getptr(p_window_id);
ERR_FAIL_N... | CCESSIBILITY_UPDATE notification.");
if (p_id.is_valid() && rid_owner.owns(p_id)) {
focus = p_id;
} else {
focus = RID();
}
}
RID AccessibilityDriverAccessKit::accessibility_get_window_root(DisplayServer::WindowID p_window_id) const {
const WindowData *wd = windows.getptr(p_window_id);
ERR_FAIL_NULL_V(wd, RI... | if (singleton->update_cb.is_valid()) {
singleton->update_cb.call(window_id);
} |
singleton->in_accessibility_update = false;
AccessibilityElement *focus_ae = singleton->rid_owner.get_or_null(singleton->focus);
uint32_t update_size = wd.update.size();
accesskit_node_id ac_focus = (accesskit_node_id)wd.root_id.get_id();
if (focus_ae && focus_ae->window_id == window_id) {
ac_focus = (accessk... | ast_based |
<fim_prefix>y) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Move Bezier Points"));
if (moving_handle == -1) {
real_t ratio = timeline->get_zoom_scale() * timeline_v_zoom;
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_han... | y) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Move Bezier Points"));
if (moving_handle == -1) {
real_t ratio = timeline->get_zoom_scale() * timeline_v_zoom;
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", moving... | undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, moving_handle_right, ratio); |
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, animation->bezier_track_get_key_out_handle(moving_handle_track, moving_handle_key), ratio);
}
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
if (ape) {
undo_redo... | ast_based |
<fim_prefix>_size(width, height, target_format, has_mipmaps);
Vector<uint8_t> dest_data;
dest_data.resize(dest_size);
uint8_t *dest_write = dest_data.ptrw();
// Decompress image.
const int mip_count = has_mipmaps ? Image::get_image_required_mipmaps(width, height, target_format) : 0;
const uint8_t *src_data = r_i... | _size(width, height, target_format, has_mipmaps);
Vector<uint8_t> dest_data;
dest_data.resize(dest_size);
uint8_t *dest_write = dest_data.ptrw();
// Decompress image.
const int mip_count = has_mipmaps ? Image::get_image_required_mipmaps(width, height, target_format) : 0;
const uint8_t *src_data = r_img->ptr();
... | int dst_mip_w, dst_mip_h; |
const int64_t dst_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, target_format, i, dst_mip_w, dst_mip_h);
// Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
ERR_FAIL_COND(dst_ofs % 8 != 0);
uint8_t *dest_mip_write = &dest_write[dst_ofs];
astcenc_image image;... | ast_based |
<fim_prefix> if (!buf) {
LLAMA_LOG_ERROR("%s: failed to allocate buffer for control vector\n", __func__);
return false;
}
ggml_backend_buffer_clear(buf, 0);
bufs.emplace_back(buf);
}
return true;
}
bool llama_adapter_cvec::apply(
const llama_model... | if (!buf) {
LLAMA_LOG_ERROR("%s: failed to allocate buffer for control vector\n", __func__);
return false;
}
ggml_backend_buffer_clear(buf, 0);
bufs.emplace_back(buf);
}
return true;
}
bool llama_adapter_cvec::apply(
const llama_model & model,
... | return true; | }
if (n_embd != (int) hparams.n_embd) {
LLAMA_LOG_ERROR("%s: control vector n_embd does not match model\n", __func__);
return false;
}
if (tensors.empty()) {
if (!init(model)) {
return false;
}
}
layer_start = il_start;
layer_end = il_end;
... | random |
<fim_prefix> * WARNING! This class points to data held within the TessBaseAPI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
MutableIt... | * WARNING! This class points to data held within the TessBaseAPI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
MutableIterator *Tess... | /** Make a text string from the internal data structures. */
char *TessBaseAPI::GetUTF8Text() {
if (tesseract_ == nullptr || (!recognition_done_ && Recognize(nullptr) < 0)) {
return nullptr; | }
std::string text("");
const std::unique_ptr</*non-const*/ ResultIterator> it(GetIterator());
do {
if (it->Empty(RIL_PARA)) {
continue;
}
auto block_type = it->BlockType();
switch (block_type) {
case PT_FLOWING_IMAGE:
case PT_HEADING_IMAGE:
case PT_PULLOUT_IMAGE:
c... | random |
<fim_prefix>
r_options->push_back(String(name).quote());
}
}
}
Node2D::get_argument_options(p_function, p_idx, r_options);
}
#endif // TOOLS_ENABLED
#ifndef DISABLE_DEPRECATED
bool AnimatedSprite2D::_set(const StringName &p_name, const Variant &p_value) {
if ((p_name == SNAME("frames"))) {
set_sprite_fra... |
r_options->push_back(String(name).quote());
}
}
}
Node2D::get_argument_options(p_function, p_idx, r_options);
}
#endif // TOOLS_ENABLED
#ifndef DISABLE_DEPRECATED
bool AnimatedSprite2D::_set(const StringName &p_name, const Variant &p_value) {
if ((p_name == SNAME("frames"))) {
set_sprite_frames(p_value)... | ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite2D::get_animation) | ;
ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimatedSprite2D::set_autoplay);
ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimatedSprite2D::get_autoplay);
ClassDB::bind_method(D_METHOD("is_playing"), &AnimatedSprite2D::is_playing);
ClassDB::bind_method(D_METHOD("play", "name", "custom_speed", "f... | ast_based |
<fim_prefix> ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
accesskit_node_set_foreground_color(ae->node, p_color.to_rgba32());
}
Error AccessibilityDriverAccessKit::init() {
#ifdef ACCESSKIT_DYNAMIC
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
int dylibloader_verbose = 0;
#endif
void *library_handle = nu... | ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
accesskit_node_set_foreground_color(ae->node, p_color.to_rgba32());
}
Error AccessibilityDriverAccessKit::init() {
#ifdef ACCESSKIT_DYNAMIC
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
int dylibloader_verbose = 0;
#endif
void *library_handle = nullptr;
Stri... | if (!FileAccess::exists(path)) { | path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("libaccesskit.so");
}
if (!FileAccess::exists(path)) {
path = OS::get_singleton()->get_executable_path().get_base_dir().path_join("../lib").path_join("libaccesskit.so");
}
if (!FileAccess::exists(path)) {
return ERR_CANT_CREATE;
}
#en... | random |
<fim_prefix>onst;
Dictionary get_donor_info() const;
Dictionary get_license_info() const;
String get_license_text() const;
void set_write_movie_path(const String &p_path);
String get_write_movie_path() const;
String get_architecture_name() const;
void set_shader_cache_path(const String &p_path);
String get_s... | onst;
Dictionary get_donor_info() const;
Dictionary get_license_info() const;
String get_license_text() const;
void set_write_movie_path(const String &p_path);
String get_write_movie_path() const;
String get_architecture_name() const;
void set_shader_cache_path(const String &p_path);
String get_shader_cache_... | bool notify_frame_server_synced(); |
void set_freeze_time_scale(bool p_frozen);
void set_embedded_in_editor(bool p_enabled);
bool is_embedded_in_editor() const;
Engine();
virtual ~Engine();
};
| ast_based |
<fim_prefix>/
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific l... | /
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language gove... | GRPC_CHECK_NE(c_creds, nullptr); |
}
CallCredentials::~CallCredentials() { grpc_call_credentials_release(c_creds_); }
grpc::string CallCredentials::DebugString() {
return absl::StrCat("CallCredentials{", c_creds_->debug_string(), "}");
}
bool CallCredentials::ApplyToCall(grpc_call* call) {
return grpc_call_set_credentials(call, c_creds_) == GRPC... | ast_based |
<fim_prefix>#include "dlhandle.h"
#include <string>
#ifndef _WIN32
# include <dlfcn.h>
#else
# include <cassert>
# include <sstream>
# define WIN32_LEAN_AND_MEAN
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
#endif
using namespace std::string_literals;
namespace fs = std::file... | #include "dlhandle.h"
#include <string>
#ifndef _WIN32
# include <dlfcn.h>
#else
# include <cassert>
# include <sstream>
# define WIN32_LEAN_AND_MEAN
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
#endif
using namespace std::string_literals;
namespace fs = std::filesystem;
#i... | dlclose(chandle); |
}
void *Dlhandle::get_internal(const char *symbol) const
{
return dlsym(chandle, symbol);
}
#else // defined(_WIN32)
Dlhandle::Dlhandle(const fs::path &fpath)
{
fs::path afpath = fs::absolute(fpath);
// Suppress the "Entry Point Not Found" dialog, caused by outdated nvcuda.dll from the GPU driver
U... | ast_based |
<fim_prefix> undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), animation->track_get_key_transition(E->get().first, E->get().second));
undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->get()... | undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), animation->track_get_key_transition(E->get().first, E->get().second));
undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->get().first, dst_... | undo_redo->add_do_method(this, "_clear_selection_for_anim", animation) | ;
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// Reselect duplicated.
int i = 0;
for (const Pair<int, real_t> &E : new_selection_values) {
undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second, i == 0);
i++;
}
i = 0;
for (SelectionSet::Element *E = sele... | ast_based |
<fim_prefix> absl::Status Run(const FeedType& inputs,
const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const;
/// Same as above. Additionally runs the operations ins `run_outputs`.
absl::Status Run(const FeedType& inputs,
const std::v... | absl::Status Run(const FeedType& inputs,
const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const;
/// Same as above. Additionally runs the operations ins `run_outputs`.
absl::Status Run(const FeedType& inputs,
const std::vector<Output... | const std::vector<Output>& fetch_outputs, | const std::vector<Operation>& run_outputs,
std::vector<Tensor>* outputs,
RunMetadata* run_metadata) const;
/// Same as above. Additionally allows user to provide custom threadpool
/// implementation via ThreadPoolOptions.
absl::Status Run(const RunOptions&... | random |
<fim_prefix> " but data path is undefined\n");
delete osd_tesseract_;
osd_tesseract_ = nullptr;
} else if (osd_tesseract_->init_tesseract(datapath_, "", "osd", OEM_TESSERACT_ONLY,
nullptr, 0, nullptr, nullptr, false, &mgr) == 0) {
... | " but data path is undefined\n");
delete osd_tesseract_;
osd_tesseract_ = nullptr;
} else if (osd_tesseract_->init_tesseract(datapath_, "", "osd", OEM_TESSERACT_ONLY,
nullptr, 0, nullptr, nullptr, false, &mgr) == 0) {
osd_tess = o... | if (tesseract_->SegmentPage(input_file_.c_str(), block_list_, osd_tess, &osr) < 0) {
return -1;
} |
// If Devanagari is being recognized, we use different images for page seg
// and for OCR.
tesseract_->PrepareForTessOCR(block_list_, osd_tess, &osr);
return 0;
}
/**
* Return average gradient of lines on page.
*/
float TessBaseAPI::GetGradient() {
return tesseract_->gradient();
}
/** Delete the pageres ... | random |
<fim_prefix>
llama_model_params model_params = common_model_params_to_llama(params);
llama_model * model = llama_model_load_from_file(params.model.path.c_str(), model_params);
if (model == NULL) {
LOG_ERR("%s: error: unable to load model\n" , __func__);
return 1;
}
const llama_voc... |
llama_model_params model_params = common_model_params_to_llama(params);
llama_model * model = llama_model_load_from_file(params.model.path.c_str(), model_params);
if (model == NULL) {
LOG_ERR("%s: error: unable to load model\n" , __func__);
return 1;
}
const llama_vocab * vocab =... |
ctx_params.n_ctx = n_kv_req;
ctx_params.n_batch = std::max(n_predict, n_parallel); |
llama_context * ctx = llama_init_from_model(model, ctx_params);
auto sparams = llama_sampler_chain_default_params();
sparams.no_perf = false;
llama_sampler * smpl = llama_sampler_chain_init(sparams);
llama_sampler_chain_add(smpl, llama_sampler_init_top_k(params.sampling.top_k));
llama_sample... | random |
<fim_prefix>lear_selection"), &AnimationBezierTrackEdit::_clear_selection);
ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationBezierTrackEdit::_clear_selection_for_anim);
ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationBezierTrackEdit::_select_at_anim);
ClassDB::bind_method(D_METHOD("... | lear_selection"), &AnimationBezierTrackEdit::_clear_selection);
ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationBezierTrackEdit::_clear_selection_for_anim);
ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationBezierTrackEdit::_select_at_anim);
ClassDB::bind_method(D_METHOD("_update_hidd... | MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"), PropertyInfo(Variant::INT, "track")) | );
ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "track")));
ADD_SIGNAL(MethodInfo("clear_selection"));
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "timeline_only")));
}
AnimationBezierTrackEd... | ast_based |
<fim_prefix>
offset_n += moving_selection_offset.x;
height_n += moving_selection_offset.y;
} else if (scaling_selection) {
offset_n += -scaling_selection_offset.x + (offset_n - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
height_n += -scaling_selection_offset.y + (height_n - scaling_... |
offset_n += moving_selection_offset.x;
height_n += moving_selection_offset.y;
} else if (scaling_selection) {
offset_n += -scaling_selection_offset.x + (offset_n - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
height_n += -scaling_selection_offset.y + (height_n - scaling_selection_pi... | if (E->prev()) {
int i_p = E->prev()->get();
offset_p = animation->track_get_key_time(p_track, i_p);
height_p = animation->bezier_track_get_key_value(p_track, i_p);
} |
animation->bezier_track_calculate_handles(offset, offset_p, height_p, offset_n, height_n, handle_mode, Animation::HANDLE_SET_MODE_AUTO, nullptr, &out_handle);
}
} else if (moving_selection_from_key == i_n) {
Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(p_track, i_n);... | ast_based |
<fim_prefix> LOG_INF("%s: Allocating [%d] x [%d] = [%d] float space for w->wcls\n",__func__,p->vocab_size , p->dim, p->vocab_size * p->dim);
}
}
catch (std::length_error &) {
die("Invalid configuration. Failed to allocate memory for weights");
}
}
static int checkpoint_init_weigh... | LOG_INF("%s: Allocating [%d] x [%d] = [%d] float space for w->wcls\n",__func__,p->vocab_size , p->dim, p->vocab_size * p->dim);
}
}
catch (std::length_error &) {
die("Invalid configuration. Failed to allocate memory for weights");
}
}
static int checkpoint_init_weights(Transform... | if (fread(w->wq.data(), sizeof(float), w->wq.size(), f) != w->wq.size()) return 1;
if (fread(w->wk.data(), sizeof(float), w->wk.size(), f) != w->wk.size()) return 1; | if (fread(w->wv.data(), sizeof(float), w->wv.size(), f) != w->wv.size()) return 1;
if (fread(w->wo.data(), sizeof(float), w->wo.size(), f) != w->wo.size()) return 1;
if (fread(w->rms_ffn_weight.data(), sizeof(float), w->rms_ffn_weight.size(), f) != w->rms_ffn_weight.size()) return 1;
if (fread(w->w1.dat... | random |
<fim_prefix> accesskit_node_set_bold(ae->node);
}
if (TS->font_get_style(font_rid).has_flag(TextServer::FONT_ITALIC)) {
accesskit_node_set_italic(ae->node);
}
accesskit_node_set_font_weight(ae->node, TS->font_get_weight(font_rid));
}
accesskit_node_set_font_size(ae->node, TS->shaped_get_run_font_... | accesskit_node_set_bold(ae->node);
}
if (TS->font_get_style(font_rid).has_flag(TextServer::FONT_ITALIC)) {
accesskit_node_set_italic(ae->node);
}
accesskit_node_set_font_weight(ae->node, TS->font_get_weight(font_rid));
}
accesskit_node_set_font_size(ae->node, TS->shaped_get_run_font_size(p_shape... | rect.x1 = run_off_x + size_x;
rect.y1 = text_height;
accesskit_node_set_bounds(ae->node, rect); | accesskit_node_add_action(ae->node, ACCESSKIT_ACTION_SCROLL_INTO_VIEW);
run_off_x += size_x;
}
{
// Add "\n" at the end.
AccessibilityElement *ae = memnew(AccessibilityElement);
ae->role = ACCESSKIT_ROLE_TEXT_RUN;
ae->window_id = parent_ae->window_id;
ae->parent = root_rid;
ae->run = Vector3i(full_ra... | random |
<fim_prefix> grpc_channel_destroy(c_channel_);
CompletionQueue* callback_cq = callback_cq_.load(std::memory_order_relaxed);
if (callback_cq != nullptr) {
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
callback_cq->Shutdown();
} else {
... | grpc_channel_destroy(c_channel_);
CompletionQueue* callback_cq = callback_cq_.load(std::memory_order_relaxed);
if (callback_cq != nullptr) {
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
callback_cq->Shutdown();
} else {
Completi... | char* value = nullptr;
memset(channel_info, 0, sizeof(*channel_info));
*channel_info_field = &value;
grpc_channel_get_info(channel, channel_info); | if (value == nullptr) return "";
std::string result = value;
gpr_free(value);
return result;
}
} // namespace
std::string Channel::GetLoadBalancingPolicyName() const {
grpc_channel_info channel_info;
return GetChannelInfoField(c_channel_, &channel_info,
&channel_info.lb_polic... | random |
<fim_prefix> =*/ n_tensors*ggml_tensor_overhead(),
/*.mem_buffer =*/ NULL,
/*.no_alloc =*/ true,
};
ggml_context * buft_ctx = ggml_init(params);
if (!buft_ctx) {
return nullptr;
}
ctx_map[buft] = buft_ctx;
... | =*/ n_tensors*ggml_tensor_overhead(),
/*.mem_buffer =*/ NULL,
/*.no_alloc =*/ true,
};
ggml_context * buft_ctx = ggml_init(params);
if (!buft_ctx) {
return nullptr;
}
ctx_map[buft] = buft_ctx;
ad... | suffix.size() | , suffix) == 0;
};
for (ggml_tensor * cur = ggml_get_first_tensor(ctx.get()); cur; cur = ggml_get_next_tensor(ctx.get(), cur)) {
std::string name(cur->name);
if (str_endswith(name, ".lora_a")) {
replace_all(name, ".lora_a", "");
if (ab_map.find(name) == ab_map.end()) {
... | ast_based |
<fim_prefix>}
/**
* Get textlines and strips of image regions as a leptonica-style Boxa, Pixa
* pair, in reading order. Enables downstream handling of non-rectangular
* regions.
* Can be called before or after Recognize.
* If blockids is not nullptr, the block-id of each line is also returned as an
* array of on... | }
/**
* Get textlines and strips of image regions as a leptonica-style Boxa, Pixa
* pair, in reading order. Enables downstream handling of non-rectangular
* regions.
* Can be called before or after Recognize.
* If blockids is not nullptr, the block-id of each line is also returned as an
* array of one element pe... | Boxa *TessBaseAPI::GetWords(Pixa **pixa) {
return GetComponentImages(RIL_WORD, true, pixa, nullptr); | }
/**
* Gets the individual connected (text) components (created
* after pages segmentation step, but before recognition)
* as a leptonica-style Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
*/
Boxa *TessBaseAPI::GetConnectedComponents(Pixa **pixa) {
return GetComponentImages(RIL... | random |
<fim_prefix> if (bd->MouseCursorInvisible)
{
al_destroy_mouse_cursor(bd->MouseCursorInvisible);
bd->MouseCursorInvisible = nullptr;
}
}
#if ALLEGRO_HAS_CLIPBOARD
static const char* ImGui_ImplAllegro5_GetClipboardText(ImGuiContext*)
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBa... | if (bd->MouseCursorInvisible)
{
al_destroy_mouse_cursor(bd->MouseCursorInvisible);
bd->MouseCursorInvisible = nullptr;
}
}
#if ALLEGRO_HAS_CLIPBOARD
static const char* ImGui_ImplAllegro5_GetClipboardText(ImGuiContext*)
{
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();... | #endif
// Not static to allow third-party code to use that if they want to (but undocumented) | ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code);
ImGuiKey ImGui_ImplAllegro5_KeyCodeToImGuiKey(int key_code)
{
switch (key_code)
{
case ALLEGRO_KEY_TAB: return ImGuiKey_Tab;
case ALLEGRO_KEY_LEFT: return ImGuiKey_LeftArrow;
case ALLEGRO_KEY_RIGHT: return ImGuiKey_RightArrow;
... | random |
<fim_prefix>is_valid()) {
if (p_request->data.has_value) {
switch (p_request->data.value.tag) {
case ACCESSKIT_ACTION_DATA_CUSTOM_ACTION: {
rq_data = p_request->data.value.custom_action;
} break;
case ACCESSKIT_ACTION_DATA_VALUE: {
rq_data = String::utf8(p_request->data.value.value);
... | is_valid()) {
if (p_request->data.has_value) {
switch (p_request->data.value.tag) {
case ACCESSKIT_ACTION_DATA_CUSTOM_ACTION: {
rq_data = p_request->data.value.custom_action;
} break;
case ACCESSKIT_ACTION_DATA_VALUE: {
rq_data = String::utf8(p_request->data.value.value);
} break;... | {
rq_data = DisplayServer::SCROLL_HINT_BOTTOM_RIGHT;
} | break;
case ACCESSKIT_SCROLL_HINT_TOP_EDGE: {
rq_data = DisplayServer::SCROLL_HINT_TOP_EDGE;
} break;
case ACCESSKIT_SCROLL_HINT_BOTTOM_EDGE: {
rq_data = DisplayServer::SCROLL_HINT_BOTTOM_EDGE;
} break;
case ACCESSKIT_SCROLL_HINT_LEFT_EDGE: {
rq_data = Display... | ast_based |
<fim_prefix> ac_focus = (accesskit_node_id)singleton->focus.get_id();
}
accesskit_tree_update *tree_update = (update_size > 0) ? accesskit_tree_update_with_capacity_and_focus(update_size, ac_focus) : accesskit_tree_update_with_focus(ac_focus);
for (const RID &rid : wd.update) {
AccessibilityElement *ae = singlet... | ac_focus = (accesskit_node_id)singleton->focus.get_id();
}
accesskit_tree_update *tree_update = (update_size > 0) ? accesskit_tree_update_with_capacity_and_focus(update_size, ac_focus) : accesskit_tree_update_with_focus(ac_focus);
for (const RID &rid : wd.update) {
AccessibilityElement *ae = singleton->rid_owne... | void AccessibilityDriverAccessKit::accessibility_update_if_active(const Callable &p_callable) {
ERR_FAIL_COND(!p_callable.is_valid()); | update_cb = p_callable;
for (KeyValue<DisplayServer::WindowID, WindowData> &window : windows) {
#ifdef WINDOWS_ENABLED
accesskit_windows_queued_events *events = accesskit_windows_subclassing_adapter_update_if_active(window.value.adapter, _accessibility_build_tree_update, (void *)(size_t)window.key);
if (events) {... | random |
<fim_prefix> ev->set_canceled(p_canceled);
ev->set_position(touch[i].pos);
ev->set_double_tap(p_double_tap);
Input::get_singleton()->parse_input_event(ev);
}
}
}
void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false, false);
touch.clear();
}
void AndroidInputHandler::process_touch_eve... | ev->set_canceled(p_canceled);
ev->set_position(touch[i].pos);
ev->set_double_tap(p_double_tap);
Input::get_singleton()->parse_input_event(ev);
}
}
}
void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false, false);
touch.clear();
}
void AndroidInputHandler::process_touch_event(int p_eve... | touch.write[i].pos = p_points[i].pos;
touch.write[i].pressure = p_points[i].pressure; |
touch.write[i].tilt = p_points[i].tilt;
}
//send touch
_parse_all_touch(true, false, p_double_tap);
} break;
case AMOTION_EVENT_ACTION_MOVE: { //motion
if (touch.size() != p_points.size()) {
return;
}
for (int i = 0; i < touch.size(); i++) {
int idx = -1;
for (int j = 0; j < p_... | ast_based |
<fim_prefix> E.value;
// Names and icon.
{
NodePath path = animation->track_get_path(tracks[0]);
Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
}
String text;
if (node) {
int ofs = 0;
Ref<Texture2D> icon = EditorNode::... | E.value;
// Names and icon.
{
NodePath path = animation->track_get_path(tracks[0]);
Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
}
String text;
if (node) {
int ofs = 0;
Ref<Texture2D> icon = EditorNode::get_singleto... | ofs += icon->get_width() + h_separation; |
margin = icon->get_width();
Vector2 string_pos = Point2(ofs, vofs);
string_pos = string_pos.floor();
text_buf.draw(get_canvas_item(), string_pos, color);
vofs += h + v_separation;
track_v_scroll_max += h + v_separation;
}
}
const Color dc = get_theme_color(SNAME("fo... | ast_based |
<fim_prefix>imation::TrackType::TYPE_BEZIER) {
if (i != track && !hidden_tracks.has(i)) {
hidden_tracks.insert(i);
}
}
}
set_animation_and_track(animation, track, read_only);
solo_track = track;
}
queue_redraw();
return;
}
return;
... | imation::TrackType::TYPE_BEZIER) {
if (i != track && !hidden_tracks.has(i)) {
hidden_tracks.insert(i);
}
}
}
set_animation_and_track(animation, track, read_only);
solo_track = track;
}
queue_redraw();
return;
}
return;
}
}
}
... | mb->is_command_or_control_pressed() | ) {
if (_try_select_at_ui_pos(mb->get_position(), mb->is_shift_pressed(), true)) {
return;
}
}
// Second, check key handles.
for (int i = 0; i < edit_points.size(); i++) {
if (!read_only) {
if (edit_points[i].in_rect.has_point(mb->get_position())) {
moving_handle = -1;
moving_handle_key... | ast_based |
<fim_prefix> real_t t = animation->track_get_key_time(E->get().first, E->get().second);
if (t < top_time) {
top_time = t;
}
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Animation Duplicate Keys"));
List<Pair<int, real_t>> new_selection_values;
... | real_t t = animation->track_get_key_time(E->get().first, E->get().second);
if (t < top_time) {
top_time = t;
}
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Animation Duplicate Keys"));
List<Pair<int, real_t>> new_selection_values;
for (Selec... | insert_pos = editor->snap_time(insert_pos); | }
}
real_t dst_time = t + (insert_pos - top_time);
int existing_idx = animation->track_find_key(E->get().first, dst_time, Animation::FIND_MODE_APPROX);
undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), an... | random |
<fim_prefix> int j = (int)((*pointIt).y / yGridStep);
pointsInCell[i*gridSize + j]++;
}
for(std::vector<cv::Mat>::iterator it = mCalibData->allCharucoCorners.begin(); it != mCalibData->allCharucoCorners.end(); ++it)
for(int l = 0; l < (*it).size[0]; l++) {
int i =... | int j = (int)((*pointIt).y / yGridStep);
pointsInCell[i*gridSize + j]++;
}
for(std::vector<cv::Mat>::iterator it = mCalibData->allCharucoCorners.begin(); it != mCalibData->allCharucoCorners.end(); ++it)
for(int l = 0; l < (*it).size[0]; l++) {
int i = (int)((*it)... | {
mCalibFlags = 0; | }
calib::calibController::calibController(cv::Ptr<calib::calibrationData> data, int initialFlags, bool autoTuning, int minFramesNum) :
mCalibData(data)
{
mCalibFlags = initialFlags;
mNeedTuning = autoTuning;
mMinFramesNum = minFramesNum;
mConfIntervalsState = false;
mCoverageQualityState = fals... | random |
<fim_prefix> if (wlen > 0) {
word_lengths.push_back(wlen);
total += wlen;
}
prev = words[j];
}
if (total < t.length()) {
word_lengths.push_back(t.length() - total);
}
accesskit_node_set_word_lengths(ae->node, word_lengths.size(), word_lengths.ptr());
// Char widths and positions.
Vector<fl... | if (wlen > 0) {
word_lengths.push_back(wlen);
total += wlen;
}
prev = words[j];
}
if (total < t.length()) {
word_lengths.push_back(t.length() - total);
}
accesskit_node_set_word_lengths(ae->node, word_lengths.size(), word_lengths.ptr());
// Char widths and positions.
Vector<float> char_po... | float advance = 0.0; | // Graphame advance.
for (int k = 0; k < gl[j].count; k++) {
advance += gl[j + k].advance;
}
int chars = gl[j].end - gl[j].start;
float adv_per_char = advance / (float)chars;
for (int k = 0; k < chars; k++) {
int index = gl[j].start + k - ae->run.x;
ERR_CONTINUE(index < 0 || index >= t.leng... | ast_based |
<fim_prefix>es.push_back(p);
if (existing_idx != -1) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, existing_idx), animation->track_get_key_transition(E->get().first, existing_idx));
}
}
undo_redo->add_do_method(this,... | es.push_back(p);
if (existing_idx != -1) {
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, existing_idx), animation->track_get_key_transition(E->get().first, existing_idx));
}
}
undo_redo->add_do_method(this, "_clear_sel... | {
real_t time = animation->track_get_key_time(E->get().first, E->get().second); |
undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, time, i == 0);
i++;
}
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
if (ape) {
undo_redo->add_do_method(ape, "_animation_update_key_frame");
undo_redo->add_undo_method(ape, "_animation_update_key_frame");
... | ast_based |
<fim_prefix>
Vector2 string_pos = Point2(ofs, vofs);
string_pos = string_pos.floor();
text_buf.draw(get_canvas_item(), string_pos, color);
vofs += h + v_separation;
track_v_scroll_max += h + v_separation;
}
}
const Color dc = get_theme_color(SNAME("font_disabled_color"), Edi... |
Vector2 string_pos = Point2(ofs, vofs);
string_pos = string_pos.floor();
text_buf.draw(get_canvas_item(), string_pos, color);
vofs += h + v_separation;
track_v_scroll_max += h + v_separation;
}
}
const Color dc = get_theme_color(SNAME("font_disabled_color"), EditorStringNam... |
Ref<Texture2D> visibility_visible = get_editor_theme_icon(SNAME("GuiVisibilityVisible"));
Ref<Texture2D> visibility_hidden = get_editor_theme_icon(SNAME("GuiVisibilityHidden")); | float visibility_hpos = lock_hpos - h_separation - visibility_visible->get_width();
Ref<Texture2D> solo = get_editor_theme_icon(SNAME("AudioBusSolo"));
float solo_hpos = visibility_hpos - h_separation - solo->get_width();
float buttons_width = remove->get_width() + lock->get_width() + visibility_visib... | random |
<fim_prefix>/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
... | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DA... |
#include "core/config/project_settings.h" | #include "core/version.h"
#include "servers/text_server.h"
AccessibilityDriverAccessKit *AccessibilityDriverAccessKit::singleton = nullptr;
_FORCE_INLINE_ accesskit_role AccessibilityDriverAccessKit::_accessibility_role(DisplayServer::AccessibilityRole p_role) const {
if (role_map.has(p_role)) {
return role_map[p... | random |
<fim_prefix> animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(index == -1);
_clear_selection();
_select_at_anim(animation, selected_track, animation->track_get_key_time(selected_track, index), true);
moving_selection_attempt = true;
moving_inserted_key = true;
... | animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(index == -1);
_clear_selection();
_select_at_anim(animation, selected_track, animation->track_get_key_time(selected_track, index), true);
moving_selection_attempt = true;
moving_inserted_key = true;
moving_se... | box_selecting_attempt = true | ;
box_selecting = false;
box_selecting_add = false;
box_selection_from = mb->get_position();
return;
}
}
if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (box_selecting) {
// Do actual select.
if (!box_selecting_add) {
_cle... | ast_based |
<fim_prefix>t_type(i) == Animation::TrackType::TYPE_BEZIER) {
visible_tracks.push_back(i);
}
}
if (visible_tracks.size() == 1) {
solo_track = visible_tracks[0];
} else {
solo_track = -1;
}
queue_redraw();
return;
} else if (I.key == SOLO_ICON) {
... | t_type(i) == Animation::TrackType::TYPE_BEZIER) {
visible_tracks.push_back(i);
}
}
if (visible_tracks.size() == 1) {
solo_track = visible_tracks[0];
} else {
solo_track = -1;
}
queue_redraw();
return;
} else if (I.key == SOLO_ICON) {
if (solo... | hidden_tracks.insert(i); |
}
}
}
set_animation_and_track(animation, track, read_only);
solo_track = track;
}
queue_redraw();
return;
}
return;
}
}
}
// Check this first, to allow manipulating key handles while ignoring keyframes before scaling/moving.
bool inside_s... | ast_based |
<fim_prefix>onTimelineEdit *timeline = nullptr;
Node *root = nullptr;
Control *play_position = nullptr; //separate control used to draw so updates for only position changed are much faster
real_t play_position_pos = 0;
Ref<Animation> animation;
bool read_only = false;
int selected_track = 0;
Vector<Rect2> view... | onTimelineEdit *timeline = nullptr;
Node *root = nullptr;
Control *play_position = nullptr; //separate control used to draw so updates for only position changed are much faster
real_t play_position_pos = 0;
Ref<Animation> animation;
bool read_only = false;
int selected_track = 0;
Vector<Rect2> view_rects;
Re... | float track_v_scroll_max = 0; |
float timeline_v_scroll = 0;
float timeline_v_zoom = 1;
PopupMenu *menu = nullptr;
void _zoom_changed();
void _update_locked_tracks_after(int p_track);
void _update_hidden_tracks_after(int p_track);
virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _menu_selected(int p_index);
void _... | ast_based |
<fim_prefix> float h = p_h;
h = (h - timeline_v_scroll) / timeline_v_zoom;
h = (get_size().height / 2.0) - h;
return h;
}
void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
float scale = timeline->get_zoom_scale();
int limit = timeline->get_name_limit();
int right_limit = get_size()... | float h = p_h;
h = (h - timeline_v_scroll) / timeline_v_zoom;
h = (get_size().height / 2.0) - h;
return h;
}
void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
float scale = timeline->get_zoom_scale();
int limit = timeline->get_name_limit();
int right_limit = get_size().width;
//... | ofs += -scaling_selection_offset.x + (ofs - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1); | }
}
key_order[ofs] = i;
}
for (RBMap<real_t, int>::Element *E = key_order.front(); E; E = E->next()) {
int i = E->get();
if (!E->next()) {
break;
}
int i_n = E->next()->get();
float offset = animation->track_get_key_time(p_track, i);
float height = animation->bezier_track_get_key_value(p_tr... | random |
<fim_prefix>ult_params);
exit(0);
} else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
print_usage(argc, argv, &default_params);
exit(1);
}
}
if (invalid_param) {
fprintf(stderr, "error: invalid parameter for argument: %s... | ult_params);
exit(0);
} else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
print_usage(argc, argv, &default_params);
exit(1);
}
}
if (invalid_param) {
fprintf(stderr, "error: invalid parameter for argument: %s\n", arg.c_s... | size_t pos = path.find_last_of("/\\"); |
if (pos == std::string::npos) {
return path;
}
return path.substr(pos + 1);
}
int main(int argc, char ** argv) {
common_init();
struct train_params params = get_default_train_params();
if (!params_parse(argc, argv, ¶ms)) {
return 1;
}
Config config;
Transforme... | ast_based |
<fim_prefix>
Mat distCoeffs = c == 2 ? distCoeffs2 : distCoeffs3;
Mat R, T, E, F;
double err = stereoCalibrate(objpt, imgpt, imgpt_right, cameraMatrix1, distCoeffs1,
cameraMatrix, distCoeffs,
imageSize, R, T, E, F,
... |
Mat distCoeffs = c == 2 ? distCoeffs2 : distCoeffs3;
Mat R, T, E, F;
double err = stereoCalibrate(objpt, imgpt, imgpt_right, cameraMatrix1, distCoeffs1,
cameraMatrix, distCoeffs,
imageSize, R, T, E, F,
... | {
R13 = R; T13 = T;
} |
}
return true;
}
static bool readStringList( const string& filename, vector<string>& l )
{
l.resize(0);
FileStorage fs(filename, FileStorage::READ);
if( !fs.isOpened() )
return false;
FileNode n = fs.getFirstTopLevelNode();
if( n.type() != FileNode::SEQ )
return false;
... | ast_based |
<fim_prefix>rn;
}
animation = p_name;
emit_signal(SceneStringName(animation_changed));
if (frames.is_null()) {
animation = StringName();
stop();
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
}
int frame_count = frames->get_frame_count(animation);
if (animation == StringName() ... | rn;
}
animation = p_name;
emit_signal(SceneStringName(animation_changed));
if (frames.is_null()) {
animation = StringName();
stop();
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
}
int frame_count = frames->get_frame_count(animation);
if (animation == StringName() || frame_cou... | queue_redraw() | ;
}
StringName AnimatedSprite2D::get_animation() const {
return animation;
}
PackedStringArray AnimatedSprite2D::get_configuration_warnings() const {
PackedStringArray warnings = Node2D::get_configuration_warnings();
if (frames.is_null()) {
warnings.push_back(RTR("A SpriteFrames resource must be created or set i... | ast_based |
<fim_prefix> is_hdr = false;
} break;
case Image::FORMAT_ASTC_4x4_HDR: {
block_x = 4;
block_y = 4;
is_hdr = true;
} break;
case Image::FORMAT_ASTC_8x8: {
block_x = 8;
block_y = 8;
is_hdr = false;
} break;
case Image::FORMAT_ASTC_8x8_HDR: {
block_x = 8;
block_y = 8;
is_hdr = true... | is_hdr = false;
} break;
case Image::FORMAT_ASTC_4x4_HDR: {
block_x = 4;
block_y = 4;
is_hdr = true;
} break;
case Image::FORMAT_ASTC_8x8: {
block_x = 8;
block_y = 8;
is_hdr = false;
} break;
case Image::FORMAT_ASTC_8x8_HDR: {
block_x = 8;
block_y = 8;
is_hdr = true;
} break;... | astcenc_error status = astcenc_config_init(profile, block_x, block_y, 1, quality, flags, &config); | ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
vformat("astcenc: Configuration initialization failed: %s.", astcenc_get_error_string(status)));
// Context allocation.
astcenc_context *context = nullptr;
const unsigned int thread_count = 1;
status = astcenc_context_alloc(&config, thread_count, &context);
ERR_FA... | random |
<fim_prefix>->Next(RIL_BLOCK);
continue;
case PT_NOISE:
tprintf("TODO: Please report image which triggers the noise case.\n");
ASSERT_HOST(false);
default:
break;
}
if (res_it->IsAtBeginningOf(RIL_BLOCK)) {
alto_str << "\t\t\t\t<ComposedBlock ID=\"" << GetID("c... | ->Next(RIL_BLOCK);
continue;
case PT_NOISE:
tprintf("TODO: Please report image which triggers the noise case.\n");
ASSERT_HOST(false);
default:
break;
}
if (res_it->IsAtBeginningOf(RIL_BLOCK)) {
alto_str << "\t\t\t\t<ComposedBlock ID=\"" << GetID("cblock", page... | {
alto_str << "\t\t\t\t\t\t<TextLine ID=\"" << GetID("line", page_number, lcnt) << "\""; |
AddBoxToAlto(res_it.get(), RIL_TEXTLINE, alto_str);
alto_str << "\n";
}
alto_str << "\t\t\t\t\t\t\t<String ID=\"" << GetID("string", page_number, wcnt) << "\"";
AddBoxToAlto(res_it.get(), RIL_WORD, alto_str);
alto_str << " CONTENT=\"";
bool last_word_in_line = res_it->IsAtFinalElement... | ast_based |
<fim_prefix> ClearResults();
}
if (!block_list_->empty()) {
return 0;
}
if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
#ifndef DISABLED_LEGACY_ENGINE
tesseract_->InitAdaptiveClassifier(nullptr);
#endif
}
if (tesseract_->pix_binary() == nullptr && !Threshold(&tesseract_->mutable_pix_... | ClearResults();
}
if (!block_list_->empty()) {
return 0;
}
if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
#ifndef DISABLED_LEGACY_ENGINE
tesseract_->InitAdaptiveClassifier(nullptr);
#endif
}
if (tesseract_->pix_binary() == nullptr && !Threshold(&tesseract_->mutable_pix_binary()->pi... | tesseract_->SetEquationDetect(equ_detect_);
}
} | #endif // ndef DISABLED_LEGACY_ENGINE
Tesseract *osd_tess = osd_tesseract_;
OSResults osr;
#ifndef DISABLED_LEGACY_ENGINE
if (PSM_OSD_ENABLED(tesseract_->tessedit_pageseg_mode) && osd_tess == nullptr) {
if (strcmp(language_.c_str(), "osd") == 0) {
osd_tess = tesseract_;
} else {
osd_tesseract... | random |
<fim_prefix>
namespace calib
{
#define OVERLAY_DELAY 1000
#define IMAGE_MAX_WIDTH 1280
#define IMAGE_MAX_HEIGHT 960
bool showOverlayMessage(const std::string& message);
enum InputType { Video, Pictures };
enum InputVideoSource { Camera, File };
enum TemplateType { AcirclesGrid, Chessboard,... |
namespace calib
{
#define OVERLAY_DELAY 1000
#define IMAGE_MAX_WIDTH 1280
#define IMAGE_MAX_HEIGHT 960
bool showOverlayMessage(const std::string& message);
enum InputType { Video, Pictures };
enum InputVideoSource { Camera, File };
enum TemplateType { AcirclesGrid, Chessboard, ChArUco, Do... | "u - enable/disable applying undistortion\n"
"d - delete all frames\n"
"v - switch visualization";
| static const double sigmaMult = 1.96;
struct calibrationData
{
cv::Mat cameraMatrix;
cv::Mat distCoeffs;
cv::Mat stdDeviations;
cv::Mat perViewErrors;
std::vector<cv::Mat> rvecs;
std::vector<cv::Mat> tvecs;
double totalAvgErr;
cv::Size imageSi... | random |
<fim_prefix>bility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
if (p_vertical) {
accesskit_node_set_orientation(ae->node, ACCESSKIT_ORIENTATION_VER... | bility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
if (p_vertical) {
accesskit_node_set_orientation(ae->node, ACCESSKIT_ORIENTATION_VERTICAL);
} e... | rid_owner.get_or_null(p_id) | ;
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
if (!p_shortcut.is_empty()) {
accesskit_node_set_keyboard_shortcut(ae->node, p_shortcut.utf8().ptr());
} else {
accesskit_node_clear_keyboard_shortcut(ae->node);
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_url(const RID &p_id, const String &p_u... | ast_based |
<fim_prefix> ggml_set_f32_nd(diff, ir, ic, 0, 0, f);
}
}
} else {
// only copy
memcpy(diff->data, diff_tmp.data(), ggml_nbytes(diff));
}
v_diff.push_back(diff);
print_debug_tensor(d... | ggml_set_f32_nd(diff, ir, ic, 0, 0, f);
}
}
} else {
// only copy
memcpy(diff->data, diff_tmp.data(), ggml_nbytes(diff));
}
v_diff.push_back(diff);
print_debug_tensor(diff);
... | std::vector<llama_token> tokens_pos;
std::vector<llama_token> tokens_neg; | size_t max_seq_len;
tokenized_prompt(llama_context * ctx, std::string pos, std::string neg) {
const llama_model * model = llama_get_model(ctx);
const llama_vocab * vocab = llama_model_get_vocab(model);
const bool add_bos = llama_vocab_get_add_bos(vocab);
tokens_pos = common_toke... | random |
<fim_prefix>#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->tessedit_resegment_from_line_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), true, block_list_);
} else if (tesseract_->tessedit_resegment_from_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), false, block_list_);
... | #ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->tessedit_resegment_from_line_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), true, block_list_);
} else if (tesseract_->tessedit_resegment_from_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), false, block_list_);
} else
#endi... | tesseract_->CorrectClassifyWords(page_res_);
return 0;
}
#ifndef DISABLED_LEGACY_ENGINE | if (tesseract_->tessedit_make_boxes_from_boxes) {
tesseract_->CorrectClassifyWords(page_res_);
return 0;
}
#endif // ndef DISABLED_LEGACY_ENGINE
int result = 0;
if (tesseract_->interactive_display_mode) {
#ifndef GRAPHICS_DISABLED
tesseract_->pgeditor_main(rect_width_, rect_height_, page_res_);
#en... | random |
<fim_prefix> }
// 6 - (undo) Reinsert overlapped keys.
List<AnimMoveRestore>::ConstIterator restore_itr = to_restore.begin();
List<Animation::HandleMode>::ConstIterator handle_itr = to_restore_handle_modes.begin();
for (; restore_itr != to_restore.end() && handle_itr != to_restore_handle_modes.end()... | }
// 6 - (undo) Reinsert overlapped keys.
List<AnimMoveRestore>::ConstIterator restore_itr = to_restore.begin();
List<Animation::HandleMode>::ConstIterator handle_itr = to_restore_handle_modes.begin();
for (; restore_itr != to_restore.end() && handle_itr != to_restore_handle_modes.end(); ++restore_... | amr.time,
key[0],
Vector2(key[1], key[2]),
Vector2(key[3], key[4]), | *handle_itr);
}
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
// 7 - Reselect.
int i = 0;
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t oldpos = animat... | random |
<fim_prefix>#include "tensorflow/compiler/tf2xla/xla_op_kernel.h"
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"
#include "tensorflow/core/framework/shape_inference.h"
namespace tensorflow {
namespace {
// Implementation of varhandle that binds a VarHandleOp to an XlaResource of the
// same name. It is not s... | #include "tensorflow/compiler/tf2xla/xla_op_kernel.h"
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"
#include "tensorflow/core/framework/shape_inference.h"
namespace tensorflow {
namespace {
// Implementation of varhandle that binds a VarHandleOp to an XlaResource of the
// same name. It is not safe to use t... |
void XlaAotOnlyVarHandleOp::Compile(XlaOpKernelContext* context) { | // Look for a resource of the same name. TF also keys that on the container
// and type attributes, but that doesn't seem necessary.
for (const auto& resource : context->xla_context()->resources()) {
if (resource->kind() == XlaResource::kVariable &&
resource->name() == name_) {
context->SetResou... | random |
<fim_prefix>ring(animation->track_get_path(selected_track));
if (is_filtered) {
if (root && root->has_node(base_path)) {
Node *node = root->get_node(base_path);
if (!node || !EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
for (int i = 0; i < animation->get_track_count(); ++i) {
... | ring(animation->track_get_path(selected_track));
if (is_filtered) {
if (root && root->has_node(base_path)) {
Node *node = root->get_node(base_path);
if (!node || !EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
for (int i = 0; i < animation->get_track_count(); ++i) {
if (anim... | {
continue; // Skip track due to not selected.
} |
set_animation_and_track(animation, i, read_only);
break;
}
}
}
}
}
queue_redraw();
}
void AnimationBezierTrackEdit::auto_fit_vertically() {
int track_count = animation->get_track_count();
real_t minimum_value = Math::INF;
real_t maximum_value = -Math::INF;
int nb_track_visible = 0;
... | ast_based |
<fim_prefix>);
recognition_done_ = true;
#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->tessedit_resegment_from_line_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), true, block_list_);
} else if (tesseract_->tessedit_resegment_from_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c... | );
recognition_done_ = true;
#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->tessedit_resegment_from_line_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), true, block_list_);
} else if (tesseract_->tessedit_resegment_from_boxes) {
page_res_ = tesseract_->ApplyBoxes(input_file_.c_str(), fals... | {
return -1;
} |
tesseract_->CorrectClassifyWords(page_res_);
return 0;
}
#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->tessedit_make_boxes_from_boxes) {
tesseract_->CorrectClassifyWords(page_res_);
return 0;
}
#endif // ndef DISABLED_LEGACY_ENGINE
int result = 0;
if (tesseract_->interactive_display_mode) {... | ast_based |
<fim_prefix> ev->set_relative(p_event_pos - hover_prev_pos);
ev->set_relative_screen_position(ev->get_relative());
Input::get_singleton()->parse_input_event(ev);
hover_prev_pos = p_event_pos;
} break;
case AMOTION_EVENT_ACTION_DOWN:
case AMOTION_EVENT_ACTION_BUTTON_PRESS: {
// Release any remaining... | ev->set_relative(p_event_pos - hover_prev_pos);
ev->set_relative_screen_position(ev->get_relative());
Input::get_singleton()->parse_input_event(ev);
hover_prev_pos = p_event_pos;
} break;
case AMOTION_EVENT_ACTION_DOWN:
case AMOTION_EVENT_ACTION_BUTTON_PRESS: {
// Release any remaining touches or ... | case AMOTION_EVENT_ACTION_UP:
case AMOTION_EVENT_ACTION_BUTTON_RELEASE: {
_release_mouse_event_info(p_source_mouse_relative);
} break;
| case AMOTION_EVENT_ACTION_MOVE: {
if (!p_source_mouse_relative && !mouse_event_info.valid) {
return;
}
Ref<InputEventMouseMotion> ev;
ev.instantiate();
_set_key_modifier_state(ev, Key::NONE);
if (p_source_mouse_relative) {
ev->set_position(hover_prev_pos);
ev->set_global_position(hover_... | random |
<fim_prefix>nimatedSprite2D::get_speed_scale() const {
return speed_scale;
}
float AnimatedSprite2D::get_playing_speed() const {
if (!playing) {
return 0;
}
return speed_scale * custom_speed_scale;
}
void AnimatedSprite2D::set_centered(bool p_center) {
if (centered == p_center) {
return;
}
centered = p_ce... | nimatedSprite2D::get_speed_scale() const {
return speed_scale;
}
float AnimatedSprite2D::get_playing_speed() const {
if (!playing) {
return 0;
}
return speed_scale * custom_speed_scale;
}
void AnimatedSprite2D::set_centered(bool p_center) {
if (centered == p_center) {
return;
}
centered = p_center;
queue... | if (hflip == p_flip) {
return;
} |
hflip = p_flip;
queue_redraw();
}
bool AnimatedSprite2D::is_flipped_h() const {
return hflip;
}
void AnimatedSprite2D::set_flip_v(bool p_flip) {
if (vflip == p_flip) {
return;
}
vflip = p_flip;
queue_redraw();
}
bool AnimatedSprite2D::is_flipped_v() const {
return vflip;
}
void AnimatedSprite2D::_res_c... | ast_based |
<fim_prefix> // load prompts
std::vector<std::string> positive_prompts = ctrlvec_load_prompt_file(params.cvector_positive_file, true);
std::vector<std::string> negative_prompts = ctrlvec_load_prompt_file(params.cvector_negative_file, true);
if (positive_prompts.size() != negative_prompts.size()) {
... | // load prompts
std::vector<std::string> positive_prompts = ctrlvec_load_prompt_file(params.cvector_positive_file, true);
std::vector<std::string> negative_prompts = ctrlvec_load_prompt_file(params.cvector_negative_file, true);
if (positive_prompts.size() != negative_prompts.size()) {
fprintf(st... | common_params params;
params.out_file = "control_vector.gguf"; |
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_CVECTOR_GENERATOR, print_usage)) {
return 1;
}
if (params.n_pca_iterations % params.n_pca_batch != 0) {
fprintf(stderr, "PCA iterations must by multiply of PCA batch size\n");
return 1;
}
callback_data cb_data;
... | random |
<fim_prefix>).valid_word(word);
}
// Returns true if utf8_character is defined in the UniCharset.
bool TessBaseAPI::IsValidCharacter(const char *utf8_character) const {
return tesseract_->unicharset.contains_unichar(utf8_character);
}
// TODO(rays) Obsolete this function and replace with a more aptly named
// functi... | ).valid_word(word);
}
// Returns true if utf8_character is defined in the UniCharset.
bool TessBaseAPI::IsValidCharacter(const char *utf8_character) const {
return tesseract_->unicharset.contains_unichar(utf8_character);
}
// TODO(rays) Obsolete this function and replace with a more aptly named
// function that retu... | {
x2 = x1 + 1;
} |
// Convert the point pair to slope/offset of the baseline (in image coords.)
*out_slope = static_cast<float>(y2 - y1) / (x2 - x1);
*out_offset = static_cast<int>(y1 - *out_slope * x1);
// Get the y-coord of the baseline at the left and right edges of the
// textline's bounding box.
int left, top, right, bo... | ast_based |
<fim_prefix>r(), "<0x%02hhX>", &byte_val) == 1) {
// Text of byte tokens is already in the expected format.
type = LLAMA_TOKEN_TYPE_BYTE;
} else {
type = LLAMA_TOKEN_TYPE_NORMAL;
}
text = llama_escape_whitespaces(text);
voc... | r(), "<0x%02hhX>", &byte_val) == 1) {
// Text of byte tokens is already in the expected format.
type = LLAMA_TOKEN_TYPE_BYTE;
} else {
type = LLAMA_TOKEN_TYPE_NORMAL;
}
text = llama_escape_whitespaces(text);
vocab->id_to_to... | size *= gg_weights->ne[dim]; |
}
for (int ct = 0; ct < size; ++ct) {
int64_t i0 = 0; int64_t i1 = 0;
int64_t i2 = 0; int64_t i3 = 0;
ggml_unravel_index(gg_weights, ct, &i0, &i1, &i2, &i3);
ggml_set_f32_nd(gg_weights, i0, i1, i2, i3, karpathy_weights[ct]);
}
}
static void save_as_llama_model(
struct m... | ast_based |
<fim_prefix>har>(borderValue[i]);
}
break;
case CV_HAL_BORDER_REPLICATE:
ctx->border = CAROTENE_NS::BORDER_MODE_REPLICATE;
break;
case CV_HAL_BORDER_REFLECT:
ctx->border = CAROTENE_NS::BORDER_MODE_REFLECT;
break;
case CV_HAL_BORDER_WRAP:
ctx->border = ... | har>(borderValue[i]);
}
break;
case CV_HAL_BORDER_REPLICATE:
ctx->border = CAROTENE_NS::BORDER_MODE_REPLICATE;
break;
case CV_HAL_BORDER_REFLECT:
ctx->border = CAROTENE_NS::BORDER_MODE_REFLECT;
break;
case CV_HAL_BORDER_WRAP:
ctx->border = CAROTENE_NS:... | delete (MorphCtx*)context; |
return CV_HAL_ERROR_OK;
}
else
{
return CV_HAL_ERROR_UNKNOWN;
}
}
#define TEGRA_MORPHIMPL(context, src_data, src_step, dst_data, dst_step, width, height, src_full_width, src_full_height, src_roi_x, src_roi_y, dst_full_width, dst_full_height, dst_roi_x, dst_roi_y) \
( \
(void)dst_ful... | ast_based |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.