text stringlengths 435 1.65k | prefix stringlengths 51 700 | middle stringlengths 10 200 | suffix stringlengths 50 700 | type stringclasses 2
values |
|---|---|---|---|---|
<fim_prefix> item_rect_changed();
}
bool AnimatedSprite2D::is_centered() const {
return centered;
}
void AnimatedSprite2D::set_offset(const Point2 &p_offset) {
if (offset == p_offset) {
return;
}
offset = p_offset;
queue_redraw();
item_rect_changed();
}
Point2 AnimatedSprite2D::get_offset() const {
return ... | item_rect_changed();
}
bool AnimatedSprite2D::is_centered() const {
return centered;
}
void AnimatedSprite2D::set_offset(const Point2 &p_offset) {
if (offset == p_offset) {
return;
}
offset = p_offset;
queue_redraw();
item_rect_changed();
}
Point2 AnimatedSprite2D::get_offset() const {
return offset;
}
v... |
void AnimatedSprite2D::_res_changed() { | set_frame_and_progress(frame, frame_progress);
queue_redraw();
notify_property_list_changed();
}
bool AnimatedSprite2D::is_playing() const {
return playing;
}
void AnimatedSprite2D::set_autoplay(const String &p_name) {
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
WARN_PRINT("Setting au... | random |
<fim_prefix>f_tmp.push_back(empty);
auto t = ggml_new_tensor_1d(ctx_ggml, GGML_TYPE_F32, n_embd);
t->data = malloc(ggml_nbytes(t)); // TODO: get rid of malloc if possible
v_final.push_back(t);
}
}
// add new rows into existing tensor in v_diff_tmp
void concat_dif... | f_tmp.push_back(empty);
auto t = ggml_new_tensor_1d(ctx_ggml, GGML_TYPE_F32, n_embd);
t->data = malloc(ggml_nbytes(t)); // TODO: get rid of malloc if possible
v_final.push_back(t);
}
}
// add new rows into existing tensor in v_diff_tmp
void concat_diff_tmp(const ... | diff_tmp.data() | + curr_size, t->data, ggml_nbytes(t));
}
}
// build the v_diff tensors from v_diff_tmp (v_diff need to be transposed)
// TODO @ngxson : maybe add option NOT to transpose v_diff; will be useful for "mean" method
void build_v_diff(bool transpose) {
printf("build_v_diff\n");
for (... | ast_based |
<fim_prefix>
const char * fn_llama2c_output_model;
const char * fn_train_data;
const char * fn_checkpoint_in;
const char * fn_checkpoint_out;
const char * fn_model_out;
uint32_t seed;
int n_ctx;
int n_embd;
int n_mult;
int n_head;
int n_layer;
int n_rotmax;
int n_t... |
const char * fn_llama2c_output_model;
const char * fn_train_data;
const char * fn_checkpoint_in;
const char * fn_checkpoint_out;
const char * fn_model_out;
uint32_t seed;
int n_ctx;
int n_embd;
int n_mult;
int n_head;
int n_layer;
int n_rotmax;
int n_threads;
... | float adam_alpha; |
float adam_decay;
int mem_model_gb;
int mem_compute_gb;
int mem_compute0_gb;
int mem_compute1_gb;
};
static void print_params(struct my_llama_hparams * params) {
LOG_INF("%s: n_vocab: %u\n", __func__, params->n_vocab);
LOG_INF("%s: n_ctx: %u\n", __func__, params->n_ctx);
LOG_INF... | ast_based |
<fim_prefix>.result);
}
TEST_SUCCESS();
}
template<std::invocable<hex::prv::Provider *&, u64, size_t, u32, u32, u32, bool, bool> Func>
int checkCrcAgainstRandomData(Func func, int width) {
// crc( message + crc(message) ) should be 0
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_... | .result);
}
TEST_SUCCESS();
}
template<std::invocable<hex::prv::Provider *&, u64, size_t, u32, u32, u32, bool, bool> Func>
int checkCrcAgainstRandomData(Func func, int width) {
// crc( message + crc(message) ) should be 0
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribu... | std::end(c.data) | , [&] { return distribData(gen); });
hex::test::TestProvider testprovider(&c.data);
hex::prv::Provider *provider = &testprovider;
u32 crc1 = func(provider, 0, c.data.size(), c.poly, c.init, c.xorOut, c.refIn, c.refOut);
std::vector<u8> data2 = c.data;
if (wi... | ast_based |
<fim_prefix> return m_temporary;
}
/**
* @brief Sets whether the achievement is unlocked
* @param unlocked Whether the achievement is unlocked
*/
void setUnlocked(bool unlocked) {
if (unlocked) {
if (m_progress < m_maxProgress)
... | return m_temporary;
}
/**
* @brief Sets whether the achievement is unlocked
* @param unlocked Whether the achievement is unlocked
*/
void setUnlocked(bool unlocked) {
if (unlocked) {
if (m_progress < m_maxProgress)
... | bool m_invisible = false; | std::vector<std::string> m_requirements, m_visibilityRequirements;
std::function<void(Achievement &)> m_clickCallback;
std::vector<u8> m_iconData;
mutable ImGuiExt::Texture m_icon;
u32 m_progress = 0;
u32 m_maxProgress = 1;
bool m_temporary = false;
f... | 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.track,
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> return -1;
}
tesseract_->PrepareForPageseg();
#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->textord_equation_detect) {
if (equ_detect_ == nullptr && !datapath_.empty()) {
equ_detect_ = new EquationDetect(datapath_.c_str(), nullptr);
}
if (equ_detect_ == nullptr) {
tprint... | return -1;
}
tesseract_->PrepareForPageseg();
#ifndef DISABLED_LEGACY_ENGINE
if (tesseract_->textord_equation_detect) {
if (equ_detect_ == nullptr && !datapath_.empty()) {
equ_detect_ = new EquationDetect(datapath_.c_str(), nullptr);
}
if (equ_detect_ == nullptr) {
tprintf("Warning: ... | osd_tess = tesseract_;
} else {
osd_tesseract_ = new Tesseract;
TessdataManager mgr(reader_); | if (datapath_.empty()) {
tprintf(
"Warning: Auto orientation and script detection requested,"
" but data path is undefined\n");
delete osd_tesseract_;
osd_tesseract_ = nullptr;
} else if (osd_tesseract_->init_tesseract(datapath_, "", "osd", OEM_TESSERACT_ONLY,... | random |
<fim_prefix>
ggml_set_name(layer.ffn_norm, (layers_i + ".ffn_norm.weight").c_str());
ggml_format_name(layer.w1, "%s.feed_forward.w1.weight", layers_i.c_str());
ggml_format_name(layer.w2, "%s.feed_forward.w2.weight", layers_i.c_str());
ggml_format_name(layer.w3, "%s.feed_forward.w3.weigh... |
ggml_set_name(layer.ffn_norm, (layers_i + ".ffn_norm.weight").c_str());
ggml_format_name(layer.w1, "%s.feed_forward.w1.weight", layers_i.c_str());
ggml_format_name(layer.w2, "%s.feed_forward.w2.weight", layers_i.c_str());
ggml_format_name(layer.w3, "%s.feed_forward.w3.weight", layers_i... | int32_t * ptr = (int32_t *) ((char *) tensor->data + i0*tensor->nb[0] + i1*tensor->nb[1]);
return *ptr;
} |
static void print_row(struct ggml_tensor * probs, int i) {
for (int k = 0; k < probs->ne[0]; ++k) {
float p = get_f32_2d(probs, k, i);
LOG(" %f", p);
}
LOG("\n");
}
static void print_matrix(struct ggml_tensor * probs) {
assert(ggml_is_matrix(probs));
for (int i = 0; i < probs->ne[1... | random |
<fim_prefix> i);
gguf_add_tensor(ctx, layer.ffn_norm);
}
gguf_write_to_file(ctx, filename, false);
gguf_free(ctx);
}
static struct train_params get_default_train_params() {
struct train_params params;
params.fn_vocab_model = "models/7B/ggml-model-f16.gguf";
params.fn_llama2c_o... | i);
gguf_add_tensor(ctx, layer.ffn_norm);
}
gguf_write_to_file(ctx, filename, false);
gguf_free(ctx);
}
static struct train_params get_default_train_params() {
struct train_params params;
params.fn_vocab_model = "models/7B/ggml-model-f16.gguf";
params.fn_llama2c_output_model ... | params.n_head = 8 | ;
params.n_layer = 16;
params.n_rotmax = 64;
params.n_threads = 6;
params.n_batch = 8;
params.n_examples = 8;
params.n_predict = 1024;
params.print_info_interval = 1;
params.print_details_interval = 2;
params.samples_start_after_nl = false;
params.use... | ast_based |
<fim_prefix> const std::unique_ptr<const PageIterator> it(AnalyseLayout());
if (it == nullptr) {
return false;
}
int x1, x2, y1, y2;
it->Baseline(RIL_TEXTLINE, &x1, &y1, &x2, &y2);
// Calculate offset and slope (NOTE: Kind of ugly)
if (x2 <= x1) {
x2 = x1 + 1;
}
// Convert the point pair to slo... | const std::unique_ptr<const PageIterator> it(AnalyseLayout());
if (it == nullptr) {
return false;
}
int x1, x2, y1, y2;
it->Baseline(RIL_TEXTLINE, &x1, &y1, &x2, &y2);
// Calculate offset and slope (NOTE: Kind of ugly)
if (x2 <= x1) {
x2 = x1 + 1;
}
// Convert the point pair to slope/offset of... | }
int left_y = IntCastRounded(*out_slope * left + *out_offset);
int right_y = IntCastRounded(*out_slope * right + *out_offset); | // Shift the baseline down so it passes through the nearest bottom-corner
// of the textline's bounding box. This is the difference between the y
// at the lowest (max) edge of the box and the actual box bottom.
*out_offset += bottom - std::max(left_y, right_y);
// Switch back to bottom-up tesseract coordinat... | random |
<fim_prefix>K_EQ(ProjectSettings::get_singleton()->localize_path("..\\path\\filename"), "../path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("/testroot/filename"), "/testroot/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("/testroot/path/filename"), "/testroot/path/file... | K_EQ(ProjectSettings::get_singleton()->localize_path("..\\path\\filename"), "../path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("/testroot/filename"), "/testroot/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("/testroot/path/filename"), "/testroot/path/filename");
CHE... | ProjectSettings::get_singleton()->localize_path("C:/testroot/path/filename") | , "C:/testroot/path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("C:/testroot/path/something/../filename"), "C:/testroot/path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("C:/testroot/path/./filename"), "C:/testroot/path/filename");
CHECK_EQ(ProjectSettings::get_single... | ast_based |
<fim_prefix> }
}
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", ani... | }
}
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.fi... | if (ape) {
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::copy_selected_keys(bool p_cut) {
if (selection.is_empty()) {
return;
}
float top_t... | random |
<fim_prefix>
* not be included in this list. To find the languages actually
* loaded use GetLoadedLanguagesAsVector.
* The returned string should NOT be deleted.
*/
const char *TessBaseAPI::GetInitLanguagesAsString() const {
return language_.c_str();
}
/**
* Returns the loaded languages in the vector of std::st... |
* not be included in this list. To find the languages actually
* loaded use GetLoadedLanguagesAsVector.
* The returned string should NOT be deleted.
*/
const char *TessBaseAPI::GetInitLanguagesAsString() const {
return language_.c_str();
}
/**
* Returns the loaded languages in the vector of std::string.
* Inc... | {
langs->push_back(tesseract_->get_sub_lang(i)->lang);
} |
}
}
/**
* Returns the available languages in the sorted vector of std::string.
*/
void TessBaseAPI::GetAvailableLanguagesAsVector(std::vector<std::string> *langs) const {
langs->clear();
if (tesseract_ != nullptr) {
addAvailableLanguages(tesseract_->datadir, langs);
std::sort(langs->begin(), langs->en... | ast_based |
<fim_prefix>ompute the number of ASTC blocks in each dimension.
unsigned int block_count_x = (src_mip_w + block_x - 1) / block_x;
unsigned int block_count_y = (src_mip_h + block_y - 1) / block_y;
size_t comp_len = block_count_x * block_count_y * 16;
const astcenc_swizzle swizzle = {
ASTCENC_SWZ_R, ASTCENC_S... | ompute the number of ASTC blocks in each dimension.
unsigned int block_count_x = (src_mip_w + block_x - 1) / block_x;
unsigned int block_count_y = (src_mip_h + block_y - 1) / block_y;
size_t comp_len = block_count_x * block_count_y * 16;
const astcenc_swizzle swizzle = {
ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCEN... | r_img->set_data(width, height, has_mipmaps, target_format, dest_data) | ;
print_verbose(vformat("astcenc: Encoding took %d ms.", OS::get_singleton()->get_ticks_msec() - start_time));
}
#endif // TOOLS_ENABLED
void _decompress_astc(Image *r_img) {
const uint64_t start_time = OS::get_singleton()->get_ticks_msec();
// Determine decompression parameters from image format.
const Image::F... | ast_based |
<fim_prefix> const Color focus_color = get_theme_color(SNAME("focus_color"), SNAME("AnimationBezierTrackEdit"));
const Color track_focus_color = get_theme_color(SNAME("track_focus_color"), SNAME("AnimationBezierTrackEdit"));
const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationBez... | const Color focus_color = get_theme_color(SNAME("focus_color"), SNAME("AnimationBezierTrackEdit"));
const Color track_focus_color = get_theme_color(SNAME("track_focus_color"), SNAME("AnimationBezierTrackEdit"));
const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationBezierTrackEdit... |
int right_limit = get_size().width; |
track_v_scroll_max = v_separation;
int vofs = v_separation + track_v_scroll;
int margin = 0;
RBMap<int, Color> subtrack_colors;
Color selected_track_color;
subtracks.clear();
subtrack_icons.clear();
RBMap<String, Vector<int>> track_indices;
int track_count = animation->get_track_count();
... | random |
<fim_prefix>h; // number of threads to use for batch processing
enum llama_rope_scaling_type rope_scaling_type; // RoPE scaling type, from `enum llama_rope_scaling_type`
enum llama_pooling_type pooling_type; // whether to pool (sum) embedding results by sequence id
enum llama_attent... | h; // number of threads to use for batch processing
enum llama_rope_scaling_type rope_scaling_type; // RoPE scaling type, from `enum llama_rope_scaling_type`
enum llama_pooling_type pooling_type; // whether to pool (sum) embedding results by sequence id
enum llama_attention_type ... | float yarn_ext_factor; | // YaRN extrapolation mix factor, negative = from model
float yarn_attn_factor; // YaRN magnitude scaling factor
float yarn_beta_fast; // YaRN low correction dim
float yarn_beta_slow; // YaRN high correction dim
uint32_t yarn_orig_ctx; // YaRN original context size
... | ast_based |
<fim_prefix> fprintf(stderr, "\n");
}
static bool params_parse(int argc, char ** argv, struct train_params * params) {
bool invalid_param = false;
bool reqd_param_found = false;
std::string arg;
struct train_params default_params = get_default_train_params();
const std::string arg_prefix = "--";... | fprintf(stderr, "\n");
}
static bool params_parse(int argc, char ** argv, struct train_params * params) {
bool invalid_param = false;
bool reqd_param_found = false;
std::string arg;
struct train_params default_params = get_default_train_params();
const std::string arg_prefix = "--";
for (i... | params->fn_vocab_model = argv[i];
} else if (arg == "--llama2c-model") {
if (++i >= argc) { | invalid_param = true;
break;
}
reqd_param_found = true;
params->fn_llama2c_model = argv[i];
} else if (arg == "--llama2c-output-model") {
if (++i >= argc) {
invalid_param = true;
break;
}
... | random |
<fim_prefix>();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation bezi... | ();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation bezier track edi... | SNAME("Label") | );
const Color h_line_color = get_theme_color(SNAME("h_line_color"), SNAME("AnimationBezierTrackEdit"));
const Color v_line_color = get_theme_color(SNAME("v_line_color"), SNAME("AnimationBezierTrackEdit"));
const Color focus_color = get_theme_color(SNAME("focus_color"), SNAME("AnimationBezierTrackEdit"));
... | ast_based |
<fim_prefix>ma_model_meta_val_str(const struct llama_model * model, const char * key, char * buf, size_t buf_size);
// Get the number of metadata key/value pairs
LLAMA_API int32_t llama_model_meta_count(const struct llama_model * model);
// Get metadata key name by index
LLAMA_API int32_t llama_model_... | ma_model_meta_val_str(const struct llama_model * model, const char * key, char * buf, size_t buf_size);
// Get the number of metadata key/value pairs
LLAMA_API int32_t llama_model_meta_count(const struct llama_model * model);
// Get metadata key name by index
LLAMA_API int32_t llama_model_meta_key_by_... | char * buf | , size_t buf_size);
// Returns the total size of all the tensors in the model in bytes
LLAMA_API uint64_t llama_model_size(const struct llama_model * model);
// Get the default chat template. Returns nullptr if not available
// If name is NULL, returns the default chat template
LLAMA_API const cha... | ast_based |
<fim_prefix>.get(), kid);
adapter.alora_invocation_tokens.resize(seq_len);
std::copy(
(const llama_token *)data,
(const llama_token *)data + seq_len,
adapter.alora_invocation_tokens.begin());
}
}
int n_tensors = gguf_get_n_tensors(... | .get(), kid);
adapter.alora_invocation_tokens.resize(seq_len);
std::copy(
(const llama_token *)data,
(const llama_token *)data + seq_len,
adapter.alora_invocation_tokens.begin());
}
}
int n_tensors = gguf_get_n_tensors(ctx_gguf.get... | 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;
adapter.ctxs.emplace_back(buft_ctx);
... | ast_based |
<fim_prefix>ect_key", callable_mp(editor, &AnimationTrackEditor::_key_deselected), CONNECT_DEFERRED);
}
void AnimationBezierTrackEdit::_play_position_draw() {
if (animation.is_null() || play_position_pos < 0) {
return;
}
float scale = timeline->get_zoom_scale();
int h = get_size().height;
int limit = timeline... | ect_key", callable_mp(editor, &AnimationTrackEditor::_key_deselected), CONNECT_DEFERRED);
}
void AnimationBezierTrackEdit::_play_position_draw() {
if (animation.is_null() || play_position_pos < 0) {
return;
}
float scale = timeline->get_zoom_scale();
int h = get_size().height;
int limit = timeline->get_name_l... | play_position_pos = p_pos; |
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::update_play_position() {
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::set_root(Node *p_root) {
root = p_root;
}
void AnimationBezierTrackEdit::set_filtered(bool p_filtered) {
is_filtered = p_filtered;
if (animation.is_null()) {
... | ast_based |
<fim_prefix> static char32_t prev_wc = 0;
char32_t unicode = p_unicode;
if ((p_unicode & 0xfffffc00) == 0xd800) {
if (prev_wc != 0) {
ERR_PRINT("invalid utf16 surrogate input");
}
prev_wc = unicode;
return; // Skip surrogate.
} else if ((unicode & 0xfffffc00) == 0xdc00) {
if (prev_wc == 0) {
ERR_PRIN... | static char32_t prev_wc = 0;
char32_t unicode = p_unicode;
if ((p_unicode & 0xfffffc00) == 0xd800) {
if (prev_wc != 0) {
ERR_PRINT("invalid utf16 surrogate input");
}
prev_wc = unicode;
return; // Skip surrogate.
} else if ((unicode & 0xfffffc00) == 0xdc00) {
if (prev_wc == 0) {
ERR_PRINT("invalid u... | Key keycode; | if (unicode == '\b') { // 0x08
keycode = Key::BACKSPACE;
} else if (unicode == '\t') { // 0x09
keycode = Key::TAB;
} else if (unicode == '\n') { // 0x0A
keycode = Key::ENTER;
} else if (unicode == 0x1B) {
keycode = Key::ESCAPE;
} else if (unicode == 0x1F) {
keycode = Key::KEY_DELETE;
} else {
keycode ... | random |
<fim_prefix>
// Initialize astcenc.
const int64_t dest_size = Image::get_image_data_size(width, height, target_format, has_mipmaps);
Vector<uint8_t> dest_data;
dest_data.resize(dest_size);
uint8_t *dest_write = dest_data.ptrw();
astcenc_config config;
config.block_x = block_x;
config.block_y = block_y;
config... |
// Initialize astcenc.
const int64_t dest_size = Image::get_image_data_size(width, height, target_format, has_mipmaps);
Vector<uint8_t> dest_data;
dest_data.resize(dest_size);
uint8_t *dest_write = dest_data.ptrw();
astcenc_config config;
config.block_x = block_x;
config.block_y = block_y;
config.profile = p... | astcenc_context *context;
const unsigned int thread_count = 1; // Godot compresses multiple images each on a thread, which is more efficient for large amount of images imported. | status = astcenc_context_alloc(&config, thread_count, &context);
ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
vformat("astcenc: Context allocation failed: %s.", astcenc_get_error_string(status)));
const int mip_count = has_mipmaps ? Image::get_image_required_mipmaps(width, height, target_format) : 0;
const uint... | random |
<fim_prefix>/ number of generated tokens
int32_t n_reused; // number of times a ggml compute graph had been reused
};
struct llama_perf_sampler_data {
double t_sample_ms; // time needed for sampling in ms
int32_t n_sample; // number of sampled tokens
};
LLAMA_API struct ll... | / number of generated tokens
int32_t n_reused; // number of times a ggml compute graph had been reused
};
struct llama_perf_sampler_data {
double t_sample_ms; // time needed for sampling in ms
int32_t n_sample; // number of sampled tokens
};
LLAMA_API struct llama_perf_con... | MA_API struct llama_perf_sampler_data llama_perf_sampler (const struct llama_sampler * chain);
| LLAMA_API void llama_perf_sampler_print(const struct llama_sampler * chain);
LLAMA_API void llama_perf_sampler_reset( struct llama_sampler * chain);
// print a breakdown of per-device memory use via LLAMA_LOG:
LLAMA_API void llama_memory_breakdown_... | ast_based |
<fim_prefix>()) : value;
replace_all(print_value, "\n", "\\n");
LLAMA_LOG_INFO("%s: - kv %3d: %42s %-16s = %s\n", __func__, i, name, type_name.c_str(), print_value.c_str());
}
auto get_kv_str = [&](const std::string & key) -> std::string {
int id = gguf_find_key(ggu... | ()) : value;
replace_all(print_value, "\n", "\\n");
LLAMA_LOG_INFO("%s: - kv %3d: %42s %-16s = %s\n", __func__, i, name, type_name.c_str(), print_value.c_str());
}
auto get_kv_str = [&](const std::string & key) -> std::string {
int id = gguf_find_key(gguf_ctx, key.c... | get_kv_str(llm_kv(LLM_KV_GENERAL_TYPE)) | ;
if (general_type != "adapter") {
throw std::runtime_error("expect general.type to be 'adapter', but got: " + general_type);
}
auto general_arch_str = get_kv_str(llm_kv(LLM_KV_GENERAL_ARCHITECTURE));
auto general_arch = llm_arch_from_string(general_arch_str);
if (ge... | ast_based |
<fim_prefix> fprintf(stderr, "\n");
}
static bool params_parse(int argc, char ** argv, struct train_params * params) {
bool invalid_param = false;
bool reqd_param_found = false;
std::string arg;
struct train_params default_params = get_default_train_params();
const std::string arg_prefix = "--";... | fprintf(stderr, "\n");
}
static bool params_parse(int argc, char ** argv, struct train_params * params) {
bool invalid_param = false;
bool reqd_param_found = false;
std::string arg;
struct train_params default_params = get_default_train_params();
const std::string arg_prefix = "--";
for (i... | if (++i >= argc) {
invalid_param = true;
break;
} | params->fn_vocab_model = argv[i];
} else if (arg == "--llama2c-model") {
if (++i >= argc) {
invalid_param = true;
break;
}
reqd_param_found = true;
params->fn_llama2c_model = argv[i];
} else if (arg == "--llama2c... | random |
<fim_prefix>/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
... | /* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS O... | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/ |
#pragma once
#ifdef ACCESSKIT_ENABLED
#include "core/templates/rid_owner.h"
#include "servers/display_server.h"
#ifdef ACCESSKIT_DYNAMIC
#ifdef LINUXBSD_ENABLED
#include "drivers/accesskit/dynwrappers/accesskit-so_wrap.h"
#endif
#ifdef MACOS_ENABLED
#include "drivers/accesskit/dynwrappers/accesskit-dylib_wrap.h"
#e... | random |
<fim_prefix>CCESSKIT_ROLE_TEXT_RUN && p_request->action == ACCESSKIT_ACTION_SCROLL_INTO_VIEW) {
AccessibilityElement *root_ae = singleton->rid_owner.get_or_null(ae->parent);
ERR_FAIL_NULL(root_ae);
ae = root_ae;
rq_data = ae->run;
}
if (ae->actions.has(p_request->action)) {
Callable &cb = ae->actions[p_req... | CCESSKIT_ROLE_TEXT_RUN && p_request->action == ACCESSKIT_ACTION_SCROLL_INTO_VIEW) {
AccessibilityElement *root_ae = singleton->rid_owner.get_or_null(ae->parent);
ERR_FAIL_NULL(root_ae);
ae = root_ae;
rq_data = ae->run;
}
if (ae->actions.has(p_request->action)) {
Callable &cb = ae->actions[p_request->action... | {
rq_data = p_request->data.value.numeric_value;
} | break;
case ACCESSKIT_ACTION_DATA_SCROLL_HINT: {
switch (p_request->data.value.scroll_hint) {
case ACCESSKIT_SCROLL_HINT_TOP_LEFT: {
rq_data = DisplayServer::SCROLL_HINT_TOP_LEFT;
} break;
case ACCESSKIT_SCROLL_HINT_BOTTOM_RIGHT: {
rq_data = DisplayServer::SCROLL_HINT_BO... | ast_based |
<fim_prefix>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_tim... | 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... | offset += moving_selection_offset.x;
height += moving_selection_offset.y; |
} else if (scaling_selection) {
offset += -scaling_selection_offset.x + (offset - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
height += -scaling_selection_offset.y + (height - scaling_selection_pivot.y) * (scaling_selection_scale.y - 1);
}
}
float offset_n = animation->track_get_ke... | ast_based |
<fim_prefix>
static void llama_adapter_lora_init_impl(llama_model & model, const char * path_lora, llama_adapter_lora & adapter) {
LLAMA_LOG_INFO("%s: loading lora adapter from '%s' ...\n", __func__, path_lora);
ggml_context * ctx_init;
gguf_init_params meta_gguf_params = {
/* .no_alloc = */ true,... |
static void llama_adapter_lora_init_impl(llama_model & model, const char * path_lora, llama_adapter_lora & adapter) {
LLAMA_LOG_INFO("%s: loading lora adapter from '%s' ...\n", __func__, path_lora);
ggml_context * ctx_init;
gguf_init_params meta_gguf_params = {
/* .no_alloc = */ true,
/* ... | LLAMA_LOG_INFO("%s: Dumping metadata keys/values.\n", __func__) | ;
// get metadata as string
for (int i = 0; i < gguf_get_n_kv(gguf_ctx); i++) {
gguf_type type = gguf_get_kv_type(gguf_ctx, i);
const std::string type_name =
type == GGUF_TYPE_ARRAY
? format("%s[%s,%zu]", gguf_type_name(type), gguf_type_name(gguf_... | ast_based |
<fim_prefix> Input::get_singleton()->parse_input_event(evd);
Ref<InputEventMouseButton> evdd = evd->duplicate();
evdd->set_pressed(false);
evdd->set_button_mask(event_buttons_mask);
Input::get_singleton()->parse_input_event(evdd);
}
void AndroidInputHandler::process_magnify(Point2 p_pos, float p_factor) {
Ref<Inp... | Input::get_singleton()->parse_input_event(evd);
Ref<InputEventMouseButton> evdd = evd->duplicate();
evdd->set_pressed(false);
evdd->set_button_mask(event_buttons_mask);
Input::get_singleton()->parse_input_event(evdd);
}
void AndroidInputHandler::process_magnify(Point2 p_pos, float p_factor) {
Ref<InputEventMagni... | _set_key_modifier_state(pan_event, Key::NONE);
pan_event->set_position(p_pos); | pan_event->set_delta(p_delta);
Input::get_singleton()->parse_input_event(pan_event);
}
MouseButton AndroidInputHandler::_button_index_from_mask(BitField<MouseButtonMask> button_mask) {
switch (button_mask) {
case MouseButtonMask::LEFT:
return MouseButton::LEFT;
case MouseButtonMask::RIGHT:
return MouseBut... | random |
<fim_prefix>language;
last_oem_requested_ = oem;
#ifndef DISABLED_LEGACY_ENGINE
// For same language and datapath, just reset the adaptive classifier.
if (reset_classifier) {
tesseract_->ResetAdaptiveClassifier();
}
#endif // ndef DISABLED_LEGACY_ENGINE
return 0;
}
/**
* Returns the languages string us... | language;
last_oem_requested_ = oem;
#ifndef DISABLED_LEGACY_ENGINE
// For same language and datapath, just reset the adaptive classifier.
if (reset_classifier) {
tesseract_->ResetAdaptiveClassifier();
}
#endif // ndef DISABLED_LEGACY_ENGINE
return 0;
}
/**
* Returns the languages string used in the la... | return language_.c_str(); |
}
/**
* Returns the loaded languages in the vector of std::string.
* Includes all languages loaded by the last Init, including those loaded
* as dependencies of other loaded languages.
*/
void TessBaseAPI::GetLoadedLanguagesAsVector(std::vector<std::string> *langs) const {
langs->clear();
if (tesseract_ != nu... | ast_based |
<fim_prefix>}
void AnimationBezierTrackEdit::_play_position_draw() {
if (animation.is_null() || play_position_pos < 0) {
return;
}
float scale = timeline->get_zoom_scale();
int h = get_size().height;
int limit = timeline->get_name_limit();
int px = (-timeline->get_value() + play_position_pos) * scale + limi... | }
void AnimationBezierTrackEdit::_play_position_draw() {
if (animation.is_null() || play_position_pos < 0) {
return;
}
float scale = timeline->get_zoom_scale();
int h = get_size().height;
int limit = timeline->get_name_limit();
int px = (-timeline->get_value() + play_position_pos) * scale + limit;
if (px ... | }
void AnimationBezierTrackEdit::update_play_position() {
play_position->queue_redraw(); | }
void AnimationBezierTrackEdit::set_root(Node *p_root) {
root = p_root;
}
void AnimationBezierTrackEdit::set_filtered(bool p_filtered) {
is_filtered = p_filtered;
if (animation.is_null()) {
return;
}
String base_path = String(animation->track_get_path(selected_track));
if (is_filtered) {
if (root && root->... | random |
<fim_prefix> 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();
swi... | 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_t... | const std::unique_ptr<const char[]> para_text(it->GetUTF8Text(RIL_PARA));
text += para_text.get();
} while (it->Next(RIL_PARA));
return copy_string(text);
} |
static void AddBoxToTSV(const PageIterator *it, PageIteratorLevel level, std::string &text) {
int left, top, right, bottom;
it->BoundingBox(level, &left, &top, &right, &bottom);
text += "\t" + std::to_string(left);
text += "\t" + std::to_string(top);
text += "\t" + std::to_string(right - left);
text += "\t... | random |
<fim_prefix>JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
Input::get_singleton()->joy_button(p_event.device, (JoyButton)p_event.index, p_event.pressed);
break;
case JOY_EVENT_AXIS:
Input::get_singleton()->joy_axis(p_event.device, (JoyAxis)p_event.index, p_event.value);
break;
... | JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
Input::get_singleton()->joy_button(p_event.device, (JoyButton)p_event.index, p_event.pressed);
break;
case JOY_EVENT_AXIS:
Input::get_singleton()->joy_axis(p_event.device, (JoyAxis)p_event.index, p_event.value);
break;
case JOY_EVE... | ev->set_meta_pressed(meta_mem) | ;
}
if (p_keycode != Key::CTRL) {
ev->set_ctrl_pressed(control_mem);
}
}
void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicode, int p_key_label, bool p_pressed, bool p_echo) {
static char32_t prev_wc = 0;
char32_t unicode = p_unicode;
if ((p_unicode & 0xfffffc00) == 0xd800) {
if (... | ast_based |
<fim_prefix>
#include "tensorflow/compiler/aot/aot_only_var_handle_op.h"
#include "tensorflow/compiler/tf2xla/xla_context.h"
#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 {
names... |
#include "tensorflow/compiler/aot/aot_only_var_handle_op.h"
#include "tensorflow/compiler/tf2xla/xla_context.h"
#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 {
// I... |
XlaAotOnlyVarHandleOp::XlaAotOnlyVarHandleOp(OpKernelConstruction* c) | : XlaOpKernel(c) {
OP_REQUIRES_OK(c, c->GetAttr("shared_name", &name_));
}
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 : cont... | random |
<fim_prefix> calling IteratorGetNextOp on a tf.data iterator.
static constexpr char kIteratorElementLayouts[] = "tf._element_layouts";
// Attribute used in tf.data ops which stores the shapes of the output elements.
static constexpr char kIteratorOutputShapes[] = "output_shapes";
// The number of list of regular tens... | calling IteratorGetNextOp on a tf.data iterator.
static constexpr char kIteratorElementLayouts[] = "tf._element_layouts";
// Attribute used in tf.data ops which stores the shapes of the output elements.
static constexpr char kIteratorOutputShapes[] = "output_shapes";
// The number of list of regular tensors used to ... | static constexpr char kAllReduceNumOpsInGroup[] =
"dtensor.all_reduce_combiner.num_ops_in_group"; |
// Attribute which stores the environment variable value for whether
// multi-device expansion is enabled: DTENSOR_ENABLE_MULTI_DEVICE_EXPANSION.
static constexpr char kEnableMultiDeviceMode[] =
"dtensor.enable_multi_device_mode";
// Attribute which stores the environment variable value for all_reduce
// optimiz... | ast_based |
<fim_prefix> const uint8_t *src_data = r_img->ptr();
for (int i = 0; i < mip_count + 1; i++) {
int src_mip_w, src_mip_h;
const int64_t src_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, r_img->get_format(), i, src_mip_w, src_mip_h);
const uint8_t *mip_data = &src_data[src_ofs];
const int6... | const uint8_t *src_data = r_img->ptr();
for (int i = 0; i < mip_count + 1; i++) {
int src_mip_w, src_mip_h;
const int64_t src_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, r_img->get_format(), i, src_mip_w, src_mip_h);
const uint8_t *mip_data = &src_data[src_ofs];
const int64_t dst_ofs ... | astcenc_image image; | image.dim_x = src_mip_w;
image.dim_y = src_mip_h;
image.dim_z = 1;
if (r_img->get_format() == Image::FORMAT_RGBA8) {
image.data_type = ASTCENC_TYPE_U8;
} else if (r_img->get_format() == Image::FORMAT_RGBAH) {
image.data_type = ASTCENC_TYPE_F16;
} else {
image.data_type = ASTCENC_TYPE_F32;
}
i... | random |
<fim_prefix>ide 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_classname.is_empty()) {
accesskit_node_set_class_name(ae->node, p_classname.utf8().ptr());
} else {
accesskit_node_clear_class_name(... | ide 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_classname.is_empty()) {
accesskit_node_set_class_name(ae->node, p_classname.utf8().ptr());
} else {
accesskit_node_clear_class_name(ae->node);
... | (!p_placeholder.is_empty()) {
accesskit_node_set_placeholder(ae->node, p_placeholder.utf8().ptr());
} | else {
accesskit_node_clear_placeholder(ae->node);
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_language(const RID &p_id, const String &p_language) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");... | ast_based |
<fim_prefix>*ad = static_cast<AudioDriverDummy *>(p_udata);
uint64_t usdelay = (ad->buffer_frames / float(ad->mix_rate)) * 1000000;
while (!ad->exit_thread.is_set()) {
if (ad->active.is_set()) {
ad->lock();
ad->start_counting_ticks();
ad->audio_server_process(ad->buffer_frames, ad->samples_in);
ad->... | *ad = static_cast<AudioDriverDummy *>(p_udata);
uint64_t usdelay = (ad->buffer_frames / float(ad->mix_rate)) * 1000000;
while (!ad->exit_thread.is_set()) {
if (ad->active.is_set()) {
ad->lock();
ad->start_counting_ticks();
ad->audio_server_process(ad->buffer_frames, ad->samples_in);
ad->stop_countin... | mutex.unlock() | ;
}
void AudioDriverDummy::set_use_threads(bool p_use_threads) {
use_threads = p_use_threads;
}
void AudioDriverDummy::set_speaker_mode(SpeakerMode p_mode) {
speaker_mode = p_mode;
}
void AudioDriverDummy::set_mix_rate(int p_rate) {
mix_rate = p_rate;
}
uint32_t AudioDriverDummy::get_channels() const {
static c... | ast_based |
<fim_prefix>ter(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 returns image coordinates rather than tesseract coordinates.
bool TessBaseAPI::GetTextDirection(int *out_offs... | ter(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 returns image coordinates rather than tesseract coordinates.
bool TessBaseAPI::GetTextDirection(int *out_offset, float *o... | 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, bottom;
if (!it->BoundingBox(RIL_TEXTLINE, &left, &top, &right, &bottom)) {
return false;
}
int left_y = IntCastRo... | ast_based |
<fim_prefix> = nullptr;
int64_t gl_count = 0;
int64_t gl_index = 0;
float run_off_x = 0.0;
Vector2i full_range;
if (p_shaped_text.is_valid()) {
text_width = TS->shaped_text_get_size(p_shaped_text).x;
text_height = MAX(text_height, TS->shaped_text_get_size(p_shaped_text).y);
words = TS->shaped_text_get_word_... | = nullptr;
int64_t gl_count = 0;
int64_t gl_index = 0;
float run_off_x = 0.0;
Vector2i full_range;
if (p_shaped_text.is_valid()) {
text_width = TS->shaped_text_get_size(p_shaped_text).x;
text_height = MAX(text_height, TS->shaped_text_get_size(p_shaped_text).y);
words = TS->shaped_text_get_word_breaks(p_sha... | accesskit_node_set_bounds(root_ae->node, root_rect) | ;
// Create text element for each run.
Vector<AccessibilityElement *> text_elements;
for (int64_t i = 0; i < run_count; i++) {
const Vector2i range = TS->shaped_get_run_range(p_shaped_text, i);
String t = TS->shaped_get_run_text(p_shaped_text, i);
if (t.is_empty()) {
continue;
}
AccessibilityElement ... | ast_based |
<fim_prefix> 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... | 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 kNumbersPer... | */
const int kBytesPerBoxFileLine = (kBytesPerNumber + 1) * kNumbersPerBlob + 1;
/** Max bytes in the decimal representation of int64_t. */ | const int kBytesPer64BitNumber = 20;
/**
* A maximal single box could occupy kNumbersPerBlob numbers at
* kBytesPer64BitNumber digits (if someone sneaks in a 64 bit value) and a
* space plus the newline and the maximum length of a UNICHAR.
* Test against this on each iteration for safety.
*/
const int kMaxBytesPer... | random |
<fim_prefix> if (ferror(fp)) {
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;
}... | if (ferror(fp)) {
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::fl... |
static bool is_ggml_file(const char * filename) {
my_llama_file file(filename, "rb");
if (file.size < 4) { | return false;
}
std::string magic = file.read_string(4);
return magic == GGUF_MAGIC;
}
static std::string llama_escape_whitespaces(const std::string & text) {
std::ostringstream out;
for (char c : text) {
if (c == ' ') out << "\xe2\x96\x81";
else out << c;
}
return o... | random |
<fim_prefix>SHIFT: return ImGuiKey_LeftShift;
case ALLEGRO_KEY_ALT: return ImGuiKey_LeftAlt;
case ALLEGRO_KEY_LWIN: return ImGuiKey_LeftSuper;
case ALLEGRO_KEY_RCTRL: return ImGuiKey_RightCtrl;
case ALLEGRO_KEY_RSHIFT: return ImGuiKey_RightShift;
case ALLEGRO_KEY_ALTGR: return Im... | SHIFT: return ImGuiKey_LeftShift;
case ALLEGRO_KEY_ALT: return ImGuiKey_LeftAlt;
case ALLEGRO_KEY_LWIN: return ImGuiKey_LeftSuper;
case ALLEGRO_KEY_RCTRL: return ImGuiKey_RightCtrl;
case ALLEGRO_KEY_RSHIFT: return ImGuiKey_RightShift;
case ALLEGRO_KEY_ALTGR: return ImGuiKey_Right... | return ImGuiKey_5; |
case ALLEGRO_KEY_6: return ImGuiKey_6;
case ALLEGRO_KEY_7: return ImGuiKey_7;
case ALLEGRO_KEY_8: return ImGuiKey_8;
case ALLEGRO_KEY_9: return ImGuiKey_9;
case ALLEGRO_KEY_A: return ImGuiKey_A;
case ALLEGRO_KEY_B: return ImGuiKey_B;
case ALLEGRO_KEY_C: return Im... | ast_based |
<fim_prefix>
run3Calibration(imgpt[0], imgpt[1], imgpt[2], imageSize,
boardSize, squareSize, aspectRatio, flags|CALIB_FIX_K4|CALIB_FIX_K5,
cameraMatrix[0], distCoeffs[0],
cameraMatrix[1], distCoeffs[1],
cameraMatrix[2], distCoeffs[2],
... |
run3Calibration(imgpt[0], imgpt[1], imgpt[2], imageSize,
boardSize, squareSize, aspectRatio, flags|CALIB_FIX_K4|CALIB_FIX_K5,
cameraMatrix[0], distCoeffs[0],
cameraMatrix[1], distCoeffs[1],
cameraMatrix[2], distCoeffs[2],
... |
fs << "R12" << R12;
fs << "T12" << T12;
fs << "R13" << R13; | fs << "T13" << T13;
fs << "imageWidth" << imageSize.width;
fs << "imageHeight" << imageSize.height;
Mat Q;
// step 3: find rectification transforms
double ratio = rectify3Collinear(cameraMatrix[0], distCoeffs[0], cameraMatrix[1],
distCoeffs[1], cameraMatrix[2], distCoeffs[2],
... | random |
<fim_prefix>_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
ae->actions[_accessibility_action(p_action)] = p_callable;
accesskit_node_add_action(ae->node, _accessibility_action(p_action));
}
void AccessibilityDriverAccessKit::accessibi... | _UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
ERR_FAIL_NULL(ae);
_ensure_node(p_id, ae);
ae->actions[_accessibility_action(p_action)] = p_callable;
accesskit_node_add_action(ae->node, _accessibility_action(p_action));
}
void AccessibilityDriverAccessKit::accessibility_update_... | {
accesskit_custom_action ca = accesskit_custom_action_new(p_action_id, p_action_description.utf8().ptr());
accesskit_node_push_custom_action(ae->node, ca);
} | else {
String cs_name = vformat("Custom Action %d", p_action_id);
accesskit_custom_action ca = accesskit_custom_action_new(p_action_id, cs_name.utf8().ptr());
accesskit_node_push_custom_action(ae->node, ca);
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_table_row_count(const RID &p_id, int p_... | ast_based |
<fim_prefix> dsa->send_window_event(DisplayServer::WINDOW_EVENT_GO_BACK_REQUEST, true);
}
}
Input::get_singleton()->parse_input_event(ev);
}
void AndroidInputHandler::_cancel_all_touch() {
_parse_all_touch(false, true);
touch.clear();
}
void AndroidInputHandler::_parse_all_touch(bool p_pressed, bool p_cancel... | dsa->send_window_event(DisplayServer::WINDOW_EVENT_GO_BACK_REQUEST, true);
}
}
Input::get_singleton()->parse_input_event(ev);
}
void AndroidInputHandler::_cancel_all_touch() {
_parse_all_touch(false, true);
touch.clear();
}
void AndroidInputHandler::_parse_all_touch(bool p_pressed, bool p_canceled, bool p_d... | void AndroidInputHandler::_release_all_touch() {
_parse_all_touch(false, false);
touch.clear();
} |
void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points, bool p_double_tap) {
switch (p_event) {
case AMOTION_EVENT_ACTION_DOWN: { //gesture begin
// Release any remaining touches or mouse event
_release_mouse_event_info();
_release_all_touch();
touch.... | random |
<fim_prefix>nt end_frame = has_animation ? MAX(0, frames->get_frame_count(animation) - 1) : 0;
bool is_changed = frame != p_frame;
if (p_frame < 0) {
frame = 0;
} else if (has_animation && p_frame > end_frame) {
frame = end_frame;
} else {
frame = p_frame;
}
_calc_frame_speed_scale();
frame_progress = p_... | nt end_frame = has_animation ? MAX(0, frames->get_frame_count(animation) - 1) : 0;
bool is_changed = frame != p_frame;
if (p_frame < 0) {
frame = 0;
} else if (has_animation && p_frame > end_frame) {
frame = end_frame;
} else {
frame = p_frame;
}
_calc_frame_speed_scale();
frame_progress = p_progress;
... | return speed_scale * custom_speed_scale; |
}
void AnimatedSprite2D::set_centered(bool p_center) {
if (centered == p_center) {
return;
}
centered = p_center;
queue_redraw();
item_rect_changed();
}
bool AnimatedSprite2D::is_centered() const {
return centered;
}
void AnimatedSprite2D::set_offset(const Point2 &p_offset) {
if (offset == p_offset) {
r... | ast_based |
<fim_prefix>ng on success, or -1 on failure
// - The output string is always null-terminated and cleared on failure
// - When retrieving a string, an extra byte must be allocated to account for the null terminator
// - GGUF array values are not supported by these functions
// Get metadata value as a st... | ng on success, or -1 on failure
// - The output string is always null-terminated and cleared on failure
// - When retrieving a string, an extra byte must be allocated to account for the null terminator
// - GGUF array values are not supported by these functions
// Get metadata value as a string by key ... | const struct llama_adapter_lora * adapter | , int32_t i, char * buf, size_t buf_size);
// Get metadata value as a string by index
LLAMA_API int32_t llama_adapter_meta_val_str_by_index(const struct llama_adapter_lora * adapter, int32_t i, char * buf, size_t buf_size);
// Manually free a LoRA adapter
// Note: loaded adapters will be free when the... | ast_based |
<fim_prefix> mutex.unlock();
}
void AudioDriverDummy::set_use_threads(bool p_use_threads) {
use_threads = p_use_threads;
}
void AudioDriverDummy::set_speaker_mode(SpeakerMode p_mode) {
speaker_mode = p_mode;
}
void AudioDriverDummy::set_mix_rate(int p_rate) {
mix_rate = p_rate;
}
uint32_t AudioDriverDummy::get_c... | mutex.unlock();
}
void AudioDriverDummy::set_use_threads(bool p_use_threads) {
use_threads = p_use_threads;
}
void AudioDriverDummy::set_speaker_mode(SpeakerMode p_mode) {
speaker_mode = p_mode;
}
void AudioDriverDummy::set_mix_rate(int p_rate) {
mix_rate = p_rate;
}
uint32_t AudioDriverDummy::get_channels() co... | uint32_t to_mix = MIN(buffer_frames, todo); | lock();
audio_server_process(to_mix, samples_in);
unlock();
uint32_t total_samples = to_mix * channels;
for (uint32_t i = 0; i < total_samples; i++) {
p_buffer[i] = samples_in[i];
}
todo -= to_mix;
p_buffer += total_samples;
}
}
void AudioDriverDummy::finish() {
if (use_threads) {
exit_thread... | random |
<fim_prefix>alibData->allCharucoCorners.end(); ++it)
for(int l = 0; l < (*it).size[0]; l++) {
int i = (int)((*it).at<float>(l, 0) / xGridStep);
int j = (int)((*it).at<float>(l, 1) / yGridStep);
pointsInCell[i*gridSize + j]++;
}
cv::Mat mean, stdDev;
cv::meanS... | alibData->allCharucoCorners.end(); ++it)
for(int l = 0; l < (*it).size[0]; l++) {
int i = (int)((*it).at<float>(l, 0) / xGridStep);
int j = (int)((*it).at<float>(l, 1) / yGridStep);
pointsInCell[i*gridSize + j]++;
}
cv::Mat mean, stdDev;
cv::meanStdDev(points... | mMinFramesNum = minFramesNum;
mConfIntervalsState = false; |
mCoverageQualityState = false;
}
void calib::calibController::updateState()
{
if(mCalibData->cameraMatrix.total()) {
const double relErrEps = 0.05;
bool fConfState = false, cConfState = false, dConfState = true;
if(sigmaMult*mCalibData->stdDeviations.at<double>(0) / mCalibData->cameraM... | ast_based |
<fim_prefix>ermissions and
// limitations under the License.
#include "errcode.h" // for ASSERT_HOST
#include "helpers.h" // for copy_string
#include "tprintf.h" // for tprintf
#include <tesseract/baseapi.h>
#include <tesseract/renderer.h>
#include <memory>
#include <sstream> // for std::stringstream
namespace tess... | ermissions and
// limitations under the License.
#include "errcode.h" // for ASSERT_HOST
#include "helpers.h" // for copy_string
#include "tprintf.h" // for tprintf
#include <tesseract/baseapi.h>
#include <tesseract/renderer.h>
#include <memory>
#include <sstream> // for std::stringstream
namespace tesseract {
///... | int vpos = top; |
int height = bottom - top;
int width = right - left;
alto_str << " HPOS=\"" << hpos << "\"";
alto_str << " VPOS=\"" << vpos << "\"";
alto_str << " WIDTH=\"" << width << "\"";
alto_str << " HEIGHT=\"" << height << "\"";
if (level == RIL_WORD) {
int wc = it->Confidence(RIL_WORD);
alto_str << " WC... | ast_based |
<fim_prefix>{
return false;
}
if (is_filtered) {
String path = String(animation->track_get_path(p_track_index));
if (root && root->has_node(path)) {
Node *node = root->get_node(path);
if (!node) {
return false; // No node, no filter.
}
if (!EditorNode::get_singleton()->get_editor_selection()->i... | {
return false;
}
if (is_filtered) {
String path = String(animation->track_get_path(p_track_index));
if (root && root->has_node(path)) {
Node *node = root->get_node(path);
if (!node) {
return false; // No node, no filter.
}
if (!EditorNode::get_singleton()->get_editor_selection()->is_selected(n... | return false; |
}
// And curves visible?
if (hidden_tracks.has(p_track_index)) {
return false;
}
return true;
}
Ref<Animation> AnimationBezierTrackEdit::get_animation() const {
return animation;
}
void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_animation, int p_track, bool p_read_only) {
an... | ast_based |
<fim_prefix> rq_data = String::utf8(p_request->data.value.value);
} break;
case ACCESSKIT_ACTION_DATA_NUMERIC_VALUE: {
rq_data = p_request->data.value.numeric_value;
} break;
case ACCESSKIT_ACTION_DATA_SCROLL_HINT: {
switch (p_request->data.value.scroll_hint) {
case ACCESSKIT_SC... | rq_data = String::utf8(p_request->data.value.value);
} break;
case ACCESSKIT_ACTION_DATA_NUMERIC_VALUE: {
rq_data = p_request->data.value.numeric_value;
} break;
case ACCESSKIT_ACTION_DATA_SCROLL_HINT: {
switch (p_request->data.value.scroll_hint) {
case ACCESSKIT_SCROLL_HINT_TO... | rq_data = DisplayServer::SCROLL_HINT_BOTTOM_EDGE; |
} break;
case ACCESSKIT_SCROLL_HINT_LEFT_EDGE: {
rq_data = DisplayServer::SCROLL_HINT_LEFT_EDGE;
} break;
case ACCESSKIT_SCROLL_HINT_RIGHT_EDGE: {
rq_data = DisplayServer::SCROLL_HINT_RIGHT_EDGE;
} break;
default:
break;
}
} break;
case ... | ast_based |
<fim_prefix>> ctx_map;
auto ctx_for_buft = [&](ggml_backend_buffer_type_t buft) -> ggml_context * {
auto it = ctx_map.find(buft);
if (it == ctx_map.end()) {
ggml_init_params params = {
/*.mem_size =*/ hparams.n_layer*ggml_tensor_overhead(),
/*.mem_buffer... | > ctx_map;
auto ctx_for_buft = [&](ggml_backend_buffer_type_t buft) -> ggml_context * {
auto it = ctx_map.find(buft);
if (it == ctx_map.end()) {
ggml_init_params params = {
/*.mem_size =*/ hparams.n_layer*ggml_tensor_overhead(),
/*.mem_buffer =*/ NULL,
... | tensors.push_back(nullptr); | // there's never a tensor for layer 0
for (size_t il = 1; il < hparams.n_layer; il++) {
ggml_backend_buffer_type_t buft = model.select_buft(il);
ggml_context * ctx = ctx_for_buft(buft);
if (!ctx) {
LLAMA_LOG_ERROR("%s: failed to allocate context for control vector\n", __func__);... | ast_based |
<fim_prefix> for(size_t i = 0; i < ctx_train.positive_entries.size(); ++i) {
bool success = false;
tokenized_prompt t = tokenized_prompts[i];
cb_data.n_layers = n_layers;
cb_data.n_tokens = t.max_seq_len;
printf("Evaluating prompt[%d/%d]: \"%s\" - \"%s\" (%d tokens)\n",
... | for(size_t i = 0; i < ctx_train.positive_entries.size(); ++i) {
bool success = false;
tokenized_prompt t = tokenized_prompts[i];
cb_data.n_layers = n_layers;
cb_data.n_tokens = t.max_seq_len;
printf("Evaluating prompt[%d/%d]: \"%s\" - \"%s\" (%d tokens)\n",
(int)... | cb_data.is_eval_pos = false; |
success = get_hidden_layers(ctx, t.tokens_neg);
if (!success) break;
// calculate diff and remove all zero rows
auto v_diff_filtered = cb_data.calc_diff();
// save & concat the filtered v_diff to ctx_train
ctx_train.concat_diff_tmp(v_diff_filtered);
// reset f... | ast_based |
<fim_prefix>name of the image file.
begin_document = true;
return true;
}
///
/// Append the ALTO XML for the layout of the image
///
bool TessAltoRenderer::AddImageHandler(TessBaseAPI *api) {
if (begin_document) {
AppendString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<alto xmlns=\"http:/... | name of the image file.
begin_document = true;
return true;
}
///
/// Append the ALTO XML for the layout of the image
///
bool TessAltoRenderer::AddImageHandler(TessBaseAPI *api) {
if (begin_document) {
AppendString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<alto xmlns=\"http://www.loc.gov... | api->GetInputName() | );
AppendString(
"</fileName>\n"
"\t\t</sourceImageInformation>\n"
"\t\t<OCRProcessing ID=\"OCR_0\">\n"
"\t\t\t<ocrProcessingStep>\n"
"\t\t\t\t<processingSoftware>\n"
"\t\t\t\t\t<softwareName>Tesseract</softwareName>\n"
"\t\t\t\t\t<softwareVersion>");
AppendString(TessB... | ast_based |
<fim_prefix>tracks.has(track)) {
hidden_tracks.erase(track);
} else {
hidden_tracks.insert(track);
if (selected_track == track) {
for (int i = 0; i < animation->get_track_count(); ++i) {
if (!hidden_tracks.has(i) && animation->track_get_type(i) == Animation::TrackType::TYPE_B... | tracks.has(track)) {
hidden_tracks.erase(track);
} else {
hidden_tracks.insert(track);
if (selected_track == track) {
for (int i = 0; i < animation->get_track_count(); ++i) {
if (!hidden_tracks.has(i) && animation->track_get_type(i) == Animation::TrackType::TYPE_BEZIER) {
... | visible_tracks.size() | == 1) {
solo_track = visible_tracks[0];
} else {
solo_track = -1;
}
queue_redraw();
return;
} else if (I.key == SOLO_ICON) {
if (solo_track == track) {
solo_track = -1;
hidden_tracks.clear();
} else {
if (hidden_tracks.has(track)) {
... | ast_based |
<fim_prefix> ERR_FAIL_COND_MSG(!in_accessibility_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);
accesskit_node_set_background_color(ae->node, p_color.to... | ERR_FAIL_COND_MSG(!in_accessibility_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);
accesskit_node_set_background_color(ae->node, p_color.to_rgba32());
... | AccessibilityElement *ae = rid_owner.get_or_null(p_id);
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;
String path;
String arc... | random |
<fim_prefix>RID &p_id, const RID &p_child_id) override;
void accessibility_update_add_related_controls(const RID &p_id, const RID &p_related_id) override;
void accessibility_update_add_related_details(const RID &p_id, const RID &p_related_id) override;
void accessibility_update_add_related_described_by(const RID &p_... | RID &p_id, const RID &p_child_id) override;
void accessibility_update_add_related_controls(const RID &p_id, const RID &p_related_id) override;
void accessibility_update_add_related_details(const RID &p_id, const RID &p_related_id) override;
void accessibility_update_add_related_described_by(const RID &p_id, const RI... | const RID &p_id | , const RID &p_other_id) override;
void accessibility_update_set_next_on_line(const RID &p_id, const RID &p_other_id) override;
void accessibility_update_set_previous_on_line(const RID &p_id, const RID &p_other_id) override;
void accessibility_update_set_member_of(const RID &p_id, const RID &p_group_id) override;
v... | ast_based |
<fim_prefix> tokens_to_str(ctx, t.tokens_pos.cbegin(), t.tokens_pos.cend()).c_str(),
tokens_to_str(ctx, t.tokens_neg.cbegin(), t.tokens_neg.cend()).c_str(),
(int) t.max_seq_len);
cb_data.is_eval_pos = true;
success = get_hidden_layers(ctx, t.tokens_pos);
if (!success... | tokens_to_str(ctx, t.tokens_pos.cbegin(), t.tokens_pos.cend()).c_str(),
tokens_to_str(ctx, t.tokens_neg.cbegin(), t.tokens_neg.cend()).c_str(),
(int) t.max_seq_len);
cb_data.is_eval_pos = true;
success = get_hidden_layers(ctx, t.tokens_pos);
if (!success) break;
... | cb_data.reset(); |
}
// done with the model, we can now free it to make gain some memory
printf("Done evaluate prompts, unload model...\n");
bool use_pca = params.cvector_dimre_method == DIMRE_METHOD_PCA;
// prepare ctx_train for PCA
ctx_train.build_v_diff(use_pca);
if (use_pca) {
// run PCA
... | ast_based |
<fim_prefix> ImGui_ImplAllegro5_CreateDeviceObjects();
// Setup display size (every frame to accommodate for window resizing)
ImGuiIO& io = ImGui::GetIO();
int w, h;
w = al_get_display_width(bd->Display);
h = al_get_display_height(bd->Display);
io.DisplaySize = ImVec2((float)w, (float)h)... | ImGui_ImplAllegro5_CreateDeviceObjects();
// Setup display size (every frame to accommodate for window resizing)
ImGuiIO& io = ImGui::GetIO();
int w, h;
w = al_get_display_width(bd->Display);
h = al_get_display_height(bd->Display);
io.DisplaySize = ImVec2((float)w, (float)h);
// Se... | // Setup mouse cursor shape | ImGui_ImplAllegro5_UpdateMouseCursor();
}
//-----------------------------------------------------------------------------
#endif // #ifndef IMGUI_DISABLE
| random |
<fim_prefix> model.hparams.n_ctx = params.n_ctx;
model.hparams.n_embd = config.dim; //params.n_embd;
model.hparams.n_ff = config.hidden_dim;
model.hparams.n_mult = 32;//params.n_mult;
model.hparams.n_head = config.n_heads; //params.n_head;
model.hparams.n_head_kv = config.n_kv_h... | model.hparams.n_ctx = params.n_ctx;
model.hparams.n_embd = config.dim; //params.n_embd;
model.hparams.n_ff = config.hidden_dim;
model.hparams.n_mult = 32;//params.n_mult;
model.hparams.n_head = config.n_heads; //params.n_head;
model.hparams.n_head_kv = config.n_kv_heads;
mo... | lcparams.no_alloc = false; |
model.ctx = ggml_init(lcparams);
init_model(&model);
model.name = basename(params.fn_llama2c_model);
save_as_llama_model(&vocab, &model, &weights, params.fn_llama2c_output_model);
LOG_INF("%s: Saving llama.c model file %s in ggml format at %s\n", __func__, params.fn_llama2c_model, params.fn_llama... | random |
<fim_prefix> "\"pp\": %d, \"tg\": %d, \"pl\": %d, \"n_kv\": %d, \"t_pp\": %f, \"speed_pp\": %f, \"t_tg\": %f, \"speed_tg\": %f, \"t\": %f, \"speed\": %f}\n",
n_kv_max, params.n_batch, params.n_ubatch, int(params.flash_attn_type), params.is_pp_shared, params.n_gpu_layers, c... | "\"pp\": %d, \"tg\": %d, \"pl\": %d, \"n_kv\": %d, \"t_pp\": %f, \"speed_pp\": %f, \"t_tg\": %f, \"speed_tg\": %f, \"t\": %f, \"speed\": %f}\n",
n_kv_max, params.n_batch, params.n_ubatch, int(params.flash_attn_type), params.is_pp_shared, params.n_gpu_layers, ctx_params.n_... | LOG("\n");
llama_perf_context_print(ctx); |
llama_batch_free(batch);
llama_free(ctx);
llama_model_free(model);
llama_backend_free();
LOG("\n\n");
return 0;
}
| random |
<fim_prefix>:WriteSettings(m_banlist_json, {{JSON_KEY, BanMapToJson(banSet)}}, errors)) {
return true;
}
for (const auto& err : errors) {
LogError("%s\n", err);
}
return false;
}
bool CBanDB::Read(banmap_t& banSet)
{
if (fs::exists(m_banlist_dat)) {
LogWarning("banlist.dat ... | :WriteSettings(m_banlist_json, {{JSON_KEY, BanMapToJson(banSet)}}, errors)) {
return true;
}
for (const auto& err : errors) {
LogError("%s\n", err);
}
return false;
}
bool CBanDB::Read(banmap_t& banSet)
{
if (fs::exists(m_banlist_dat)) {
LogWarning("banlist.dat ignored beca... | common::ReadSettings(m_banlist_json, settings, errors) | ) {
for (const auto& err : errors) {
LogWarning("Cannot load banlist %s: %s", fs::PathToString(m_banlist_json), err);
}
return false;
}
try {
BanMapFromJson(settings[JSON_KEY], banSet);
} catch (const std::runtime_error& e) {
LogWarning("Cannot parse banl... | ast_based |
<fim_prefix>#pragma once
#include <hex.hpp>
#include <functional>
#include <list>
#include <memory>
#include <span>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/api/localization_manager.hpp>
#include <hex/h... | #pragma once
#include <hex.hpp>
#include <functional>
#include <list>
#include <memory>
#include <span>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/auto_... |
/**
* @brief Returns the unlocalized name of the achievement
* @return Unlocalized name of the achievement
*/ | [[nodiscard]] const UnlocalizedString &getUnlocalizedName() const {
return m_unlocalizedName;
}
/**
* @brief Returns the unlocalized category of the achievement
* @return Unlocalized category of the achievement
*/
[[nodiscard]] const UnlocalizedStr... | random |
<fim_prefix> ERR_FAIL_NULL(ae);
AccessibilityElement *start_ae = rid_owner.get_or_null(p_text_start_id);
ERR_FAIL_NULL(start_ae);
ERR_FAIL_COND(start_ae->window_id != ae->window_id);
AccessibilityElement *end_ae = rid_owner.get_or_null(p_text_end_id);
ERR_FAIL_NULL(end_ae);
ERR_FAIL_COND(end_ae->window_id != ae->... | ERR_FAIL_NULL(ae);
AccessibilityElement *start_ae = rid_owner.get_or_null(p_text_start_id);
ERR_FAIL_NULL(start_ae);
ERR_FAIL_COND(start_ae->window_id != ae->window_id);
AccessibilityElement *end_ae = rid_owner.get_or_null(p_text_end_id);
ERR_FAIL_NULL(end_ae);
ERR_FAIL_COND(end_ae->window_id != ae->window_id);
... | start_pos = p_start_char - child_ae->run.x; | break;
}
}
}
for (const RID &rid : end_ae->children) {
const AccessibilityElement *child_ae = rid_owner.get_or_null(rid);
if (child_ae && child_ae->role == ACCESSKIT_ROLE_TEXT_RUN) {
if (p_end_char >= child_ae->run.x && p_end_char <= child_ae->run.y) {
end_rid = rid;
end_pos = p_end_char - chi... | random |
<fim_prefix>
if (!p_description.is_empty()) {
accesskit_node_set_role_description(ae->node, p_description.utf8().ptr());
} else {
accesskit_node_clear_role_description(ae->node);
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_state_description(const RID &p_id, const String &p_description) {
ER... |
if (!p_description.is_empty()) {
accesskit_node_set_role_description(ae->node, p_description.utf8().ptr());
} else {
accesskit_node_clear_role_description(ae->node);
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_state_description(const RID &p_id, const String &p_description) {
ERR_FAIL_COND_... | accesskit_node_clear_state_description(ae->node);
}
} |
void AccessibilityDriverAccessKit::accessibility_update_set_color_value(const RID &p_id, const Color &p_color) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_null(p_id);
... | random |
<fim_prefix> ctx->border = CAROTENE_NS::BORDER_MODE_CONSTANT;
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_WRA... | ctx->border = CAROTENE_NS::BORDER_MODE_CONSTANT;
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:
c... | {
delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED; | }
switch(kernel_type)
{
case CV_8UC1:
ctx->kernelx_data[0]=kernelx_data[0];
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]=kernel... | random |
<fim_prefix>cnt = 0;
if (input_file_.empty()) {
SetInputName(nullptr);
}
std::stringstream alto_str;
// Use "C" locale (needed for int values larger than 999).
alto_str.imbue(std::locale::classic());
alto_str << "\t\t<Page WIDTH=\"" << rect_width_ << "\" HEIGHT=\"" << rect_height_
<< "\" PH... | cnt = 0;
if (input_file_.empty()) {
SetInputName(nullptr);
}
std::stringstream alto_str;
// Use "C" locale (needed for int values larger than 999).
alto_str.imbue(std::locale::classic());
alto_str << "\t\t<Page WIDTH=\"" << rect_width_ << "\" HEIGHT=\"" << rect_height_
<< "\" PHYSICAL_IMG_N... | res_it->Next(RIL_WORD) | ;
continue;
}
int left, top, right, bottom;
auto block_type = res_it->BlockType();
switch (block_type) {
case PT_FLOWING_IMAGE:
case PT_HEADING_IMAGE:
case PT_PULLOUT_IMAGE: {
// Handle all kinds of images.
// TODO: optionally add TYPE, for example TYPE="photo".... | ast_based |
<fim_prefix>ficient to provide a Pix directly.
*/
void TessBaseAPI::SetImage(Pix *pix) {
if (InternalSetImage()) {
if (pixGetSpp(pix) == 4 && pixGetInputFormat(pix) == IFF_PNG) {
// remove alpha channel from png
Pix *p1 = pixRemoveAlpha(pix);
pixSetSpp(p1, 3);
(void)pixCopy(pix, p1);
... | ficient to provide a Pix directly.
*/
void TessBaseAPI::SetImage(Pix *pix) {
if (InternalSetImage()) {
if (pixGetSpp(pix) == 4 && pixGetInputFormat(pix) == IFF_PNG) {
// remove alpha channel from png
Pix *p1 = pixRemoveAlpha(pix);
pixSetSpp(p1, 3);
(void)pixCopy(pix, p1);
pixDestroy... | if (thresholder_ == nullptr) {
return;
} |
thresholder_->SetRectangle(left, top, width, height);
ClearResults();
}
/**
* ONLY available after SetImage if you have Leptonica installed.
* Get a copy of the internal thresholded image from Tesseract.
*/
Pix *TessBaseAPI::GetThresholdedImage() {
if (tesseract_ == nullptr || thresholder_ == nullptr) {
... | ast_based |
<fim_prefix>paration, text_buf.get_size().y * 0.8), track_color);
subtrack_colors[current_track] = track_color;
subtracks[current_track] = rect;
} else {
draw_rect(rect, track_focus_color);
if (locked_tracks.has(selected_track)) {
selected_track_color.set_hsv(h, 0.0, 0.4);
} e... | paration, text_buf.get_size().y * 0.8), track_color);
subtrack_colors[current_track] = track_color;
subtracks[current_track] = rect;
} else {
draw_rect(rect, track_focus_color);
if (locked_tracks.has(selected_track)) {
selected_track_color.set_hsv(h, 0.0, 0.4);
} else {
... | (read_only) {
draw_texture(remove, remove_rect.position, dc);
} | else {
draw_texture(remove, remove_rect.position);
}
Rect2 lock_rect = Rect2(lock_hpos, icon_start_height - lock->get_height() / 2.0, lock->get_width(), lock->get_height());
if (locked_tracks.has(current_track)) {
draw_texture(lock, lock_rect.position);
} else {
draw_texture(unlo... | ast_based |
<fim_prefix>nomial(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step,
int width, int height, int depth, int cn, size_t margin_left, size_t margin_top,
size_t margin_right, size_t margin_bottom, size_t ksize, int border_type)
{
CAROTENE_NS::Siz... | nomial(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step,
int width, int height, int depth, int cn, size_t margin_left, size_t margin_top,
size_t margin_right, size_t margin_bottom, size_t ksize, int border_type)
{
CAROTENE_NS::Size2D sz(width... | CAROTENE_NS::gaussianBlur3x3Margin(sz, src_data, src_step, dst_data, dst_step,
border, 0, mg) | ;
return CV_HAL_ERROR_OK;
}
}
else if (ksize == 5)
{
if (!CAROTENE_NS::isGaussianBlur5x5Supported(sz, cn, border))
return CV_HAL_ERROR_NOT_IMPLEMENTED;
if (depth == CV_8U)
{
CAROTENE_NS::gaussianBlur5x5(sz, cn, (uint8_t*)src_data, src_step... | ast_based |
<fim_prefix>ctRatio;
string outputFilename;
string inputFilename = "";
vector<vector<Point2f> > imgpt[3];
vector<string> imageList;
cv::CommandLineParser parser(argc, argv,
"{help ||}{w||}{h||}{s|1|}{o|out_camera_data.yml|}"
"{zt||}{a|1|}{p||}{@input||}");
if (parser.has("help"... | ctRatio;
string outputFilename;
string inputFilename = "";
vector<vector<Point2f> > imgpt[3];
vector<string> imageList;
cv::CommandLineParser parser(argc, argv,
"{help ||}{w||}{h||}{s|1|}{o|out_camera_data.yml|}"
"{zt||}{a|1|}{p||}{@input||}");
if (parser.has("help"))
{
... | flags |= CALIB_FIX_PRINCIPAL_POINT | ;
outputFilename = parser.get<string>("o");
inputFilename = parser.get<string>("@input");
if (!parser.check())
{
help(argv);
parser.printErrors();
return -1;
}
if (boardSize.width <= 0)
return fprintf( stderr, "Invalid board width\n" ), -1;
if (boardSize.heigh... | ast_based |
<fim_prefix>
bool TessBaseAPI::ProcessPage(Pix *pix, int page_index, const char *filename,
const char *retry_config, int timeout_millisec,
TessResultRenderer *renderer) {
SetInputName(filename);
SetImage(pix);
bool failed = false;
if (tesseract_->tess... |
bool TessBaseAPI::ProcessPage(Pix *pix, int page_index, const char *filename,
const char *retry_config, int timeout_millisec,
TessResultRenderer *renderer) {
SetInputName(filename);
SetImage(pix);
bool failed = false;
if (tesseract_->tessedit_pageseg... | monitor.cancel_this = nullptr | ;
monitor.set_deadline_msecs(timeout_millisec);
// Now run the main recognition.
failed = Recognize(&monitor) < 0;
} else {
// Normal layout and character recognition with no timeout.
failed = Recognize(nullptr) < 0;
}
if (tesseract_->tessedit_write_images) {
Pix *page_pix = GetThreshold... | ast_based |
<fim_prefix>splayServer::AccessibilityFlags::FLAG_VISITED: {
if (p_value) {
accesskit_node_set_visited(ae->node);
} else {
accesskit_node_clear_visited(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_BUSY: {
if (p_value) {
accesskit_node_set_busy(ae->node);
} else {
... | splayServer::AccessibilityFlags::FLAG_VISITED: {
if (p_value) {
accesskit_node_set_visited(ae->node);
} else {
accesskit_node_clear_visited(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_BUSY: {
if (p_value) {
accesskit_node_set_busy(ae->node);
} else {
accesskit_n... | accesskit_node_clear_touch_transparent(ae->node); |
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_READONLY: {
if (p_value) {
accesskit_node_set_read_only(ae->node);
} else {
accesskit_node_clear_read_only(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_DISABLED: {
if (p_value) {
accesskit_node_set_disabled... | ast_based |
<fim_prefix>
break;
}
}
ERR_CONTINUE(idx == -1);
if (touch[i].pos == p_points[idx].pos) {
continue; // Don't move unnecessarily.
}
Ref<InputEventScreenDrag> ev;
ev.instantiate();
ev->set_index(touch[i].id);
ev->set_position(p_points[idx].pos);
ev->set_relative(p_po... |
break;
}
}
ERR_CONTINUE(idx == -1);
if (touch[i].pos == p_points[idx].pos) {
continue; // Don't move unnecessarily.
}
Ref<InputEventScreenDrag> ev;
ev.instantiate();
ev->set_index(touch[i].id);
ev->set_position(p_points[idx].pos);
ev->set_relative(p_points[idx].po... | //release
_release_all_touch(); |
} break;
case AMOTION_EVENT_ACTION_POINTER_DOWN: { // add touch
for (int i = 0; i < p_points.size(); i++) {
if (p_points[i].id == p_pointer) {
TouchPos tp = p_points[i];
touch.push_back(tp);
Ref<InputEventScreenTouch> ev;
ev.instantiate();
ev->set_index(tp.id);
ev->set_presse... | ast_based |
<fim_prefix>_model * llama_model_load_from_splits(
const char ** paths,
size_t n_paths,
struct llama_model_params params);
LLAMA_API void llama_model_save_to_file(
const struct llama_model * model,
... | _model * llama_model_load_from_splits(
const char ** paths,
size_t n_paths,
struct llama_model_params params);
LLAMA_API void llama_model_save_to_file(
const struct llama_model * model,
const char ... | LLAMA_API struct llama_context * llama_new_context_with_model(
struct llama_model * model,
struct llama_context_params params) | ,
"use llama_init_from_model instead");
// Frees all allocated memory
LLAMA_API void llama_free(struct llama_context * ctx);
LLAMA_API int64_t llama_time_us(void);
LLAMA_API size_t llama_max_devices(void);
LLAMA_API size_t llama_max_parallel_sequences(void);
LLAMA_API bool llama_... | ast_based |
<fim_prefix>KeyEvent(key, (ev->type == ALLEGRO_EVENT_KEY_DOWN));
io.SetKeyEventNativeData(key, ev->keyboard.keycode, -1); // To support legacy indexing (<1.87 user code)
}
return true;
case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT:
if (ev->display.source == bd->Display)
io.Ad... | KeyEvent(key, (ev->type == ALLEGRO_EVENT_KEY_DOWN));
io.SetKeyEventNativeData(key, ev->keyboard.keycode, -1); // To support legacy indexing (<1.87 user code)
}
return true;
case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT:
if (ev->display.source == bd->Display)
io.AddFocusEvent(... | ImGui::GetIO() | ;
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
return;
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
// Hide OS mouse cursor if imgui is drawing it
if (io.MouseDrawCursor)
imgui_cursor = ImG... | ast_based |
<fim_prefix>kRemoteFunction:
return "Remote Function";
case ActivityCategory::kMisc:
return "Miscellaneous";
case ActivityCategory::kDatasetOp:
return "Dataset Op";
case ActivityCategory::kTpuOp:
return "TPU Op";
case ActivityCategory::kRendezvous:
return "Rendezvous";
}
... | kRemoteFunction:
return "Remote Function";
case ActivityCategory::kMisc:
return "Miscellaneous";
case ActivityCategory::kDatasetOp:
return "Dataset Op";
case ActivityCategory::kTpuOp:
return "TPU Op";
case ActivityCategory::kRendezvous:
return "Rendezvous";
}
}
// An act... | tsl::string title | , ActivityCategory category)
: title(std::move(title)), category(category) {}
Activity(tsl::string title, ActivityCategory category, Attributes attributes)
: title(std::move(title)),
category(category),
attributes(std::move(attributes)) {}
};
// Enable activity wathcer to send own workers... | ast_based |
<fim_prefix> "\"pp\": %d, \"tg\": %d, \"pl\": %d, \"n_kv\": %d, \"t_pp\": %f, \"speed_pp\": %f, \"t_tg\": %f, \"speed_tg\": %f, \"t\": %f, \"speed\": %f}\n",
n_kv_max, params.n_batch, params.n_ubatch, int(params.flash_attn_type), params.is_pp_shared, params.n_gpu_layers, c... | "\"pp\": %d, \"tg\": %d, \"pl\": %d, \"n_kv\": %d, \"t_pp\": %f, \"speed_pp\": %f, \"t_tg\": %f, \"speed_tg\": %f, \"t\": %f, \"speed\": %f}\n",
n_kv_max, params.n_batch, params.n_ubatch, int(params.flash_attn_type), params.is_pp_shared, params.n_gpu_layers, ctx_params.n_... | }
LOG("\n"); | llama_perf_context_print(ctx);
llama_batch_free(batch);
llama_free(ctx);
llama_model_free(model);
llama_backend_free();
LOG("\n\n");
return 0;
}
| random |
<fim_prefix>
role_map[DisplayServer::AccessibilityRole::ROLE_BUTTON] = ACCESSKIT_ROLE_BUTTON;
role_map[DisplayServer::AccessibilityRole::ROLE_LINK] = ACCESSKIT_ROLE_LINK;
role_map[DisplayServer::AccessibilityRole::ROLE_CHECK_BOX] = ACCESSKIT_ROLE_CHECK_BOX;
role_map[DisplayServer::AccessibilityRole::ROLE_RADIO_BUTT... |
role_map[DisplayServer::AccessibilityRole::ROLE_BUTTON] = ACCESSKIT_ROLE_BUTTON;
role_map[DisplayServer::AccessibilityRole::ROLE_LINK] = ACCESSKIT_ROLE_LINK;
role_map[DisplayServer::AccessibilityRole::ROLE_CHECK_BOX] = ACCESSKIT_ROLE_CHECK_BOX;
role_map[DisplayServer::AccessibilityRole::ROLE_RADIO_BUTTON] = ACCESS... | role_map[DisplayServer::AccessibilityRole::ROLE_SLIDER] = ACCESSKIT_ROLE_SLIDER; |
role_map[DisplayServer::AccessibilityRole::ROLE_SPIN_BUTTON] = ACCESSKIT_ROLE_SPIN_BUTTON;
role_map[DisplayServer::AccessibilityRole::ROLE_PROGRESS_INDICATOR] = ACCESSKIT_ROLE_PROGRESS_INDICATOR;
role_map[DisplayServer::AccessibilityRole::ROLE_TEXT_FIELD] = ACCESSKIT_ROLE_TEXT_INPUT;
role_map[DisplayServer::Access... | ast_based |
<fim_prefix>t read_f32() {
std::float_t ret;
read_raw(&ret, sizeof(ret));
return ret;
}
std::string read_string(std::uint32_t len) {
std::vector<char> chars(len);
read_raw(chars.data(), len);
return std::string(chars.data(), len);
}
~my_llama_file() {
... | t read_f32() {
std::float_t ret;
read_raw(&ret, sizeof(ret));
return ret;
}
std::string read_string(std::uint32_t len) {
std::vector<char> chars(len);
read_raw(chars.data(), len);
return std::string(chars.data(), len);
}
~my_llama_file() {
if (fp... | for (char c : text) {
if (c == ' ') out << "\xe2\x96\x81";
else out << c;
}
return out.str(); |
}
static void load_vocab(const char * filename, const Config * config, struct my_llama_vocab * vocab) {
if (is_ggml_file(filename)) {
LOG_INF("%s: Loading vocabulary from gguf file %s\n", __func__, filename);
struct ggml_context * ctx_data = NULL;
struct gguf_init_params params = {
... | ast_based |
<fim_prefix> }
}
/**
* Return the length of the output text string, as UTF8, assuming
* liberally two spacing marks after each word (as paragraphs end with two
* newlines), and assuming a single character reject marker for each rejected
* character.
* Also return the number of recognized blobs in blob_count.
*/... | }
}
/**
* Return the length of the output text string, as UTF8, assuming
* liberally two spacing marks after each word (as paragraphs end with two
* newlines), and assuming a single character reject marker for each rejected
* character.
* Also return the number of recognized blobs in blob_count.
*/
int TessBas... | WERD_RES *word = page_res_it.word();
WERD_CHOICE *choice = word->best_choice; | if (choice != nullptr) {
total_blobs += choice->length() + 2;
total_length += choice->unichar_string().length() + 2;
for (int i = 0; i < word->reject_map.length(); ++i) {
if (word->reject_map[i].rejected()) {
++total_length;
}
}
}
}
if (blob_count != nullptr... | random |
<fim_prefix> word_res->word->set_text(wordstr);
// Check to see if text matches wordstr.
int w = 0;
int t;
for (t = 0; text[t] != '\0'; ++t) {
if (text[t] == '\n' || text[t] == ' ') {
continue;
}
while (wordstr[w] == ' ') {
++w;
}
... | word_res->word->set_text(wordstr);
// Check to see if text matches wordstr.
int w = 0;
int t;
for (t = 0; text[t] != '\0'; ++t) {
if (text[t] == '\n' || text[t] == ' ') {
continue;
}
while (wordstr[w] == ' ') {
++w;
}
if (text[t] ... | PAGE_RES_IT pr_it(page_res_); | if (pr_it.word() == nullptr) {
success = false;
} else {
word_res = pr_it.word();
}
} else {
word_res->BestChoiceToCorrectText();
}
if (success) {
tesseract_->EnableLearning = true;
tesseract_->LearnWord(nullptr, word_res);
}
... | random |
<fim_prefix> astcenc_context *context = nullptr;
const unsigned int thread_count = 1;
status = astcenc_context_alloc(&config, thread_count, &context);
ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
vformat("astcenc: Context allocation failed: %s.", astcenc_get_error_string(status)));
const Image::Format target_f... | astcenc_context *context = nullptr;
const unsigned int thread_count = 1;
status = astcenc_context_alloc(&config, thread_count, &context);
ERR_FAIL_COND_MSG(status != ASTCENC_SUCCESS,
vformat("astcenc: Context allocation failed: %s.", astcenc_get_error_string(status)));
const Image::Format target_format = is_h... |
// 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(); |
for (int i = 0; i < mip_count + 1; i++) {
const int64_t src_ofs = Image::get_image_mipmap_offset(width, height, src_format, i);
const uint8_t *mip_data = &src_data[src_ofs];
int64_t src_size;
if (i == mip_count) {
src_size = r_img->get_data_size() - src_ofs;
} else {
src_size = Image::get_image_mipma... | random |
<fim_prefix> training font and returns it in fontname, by cutting
// it out based on the expectation that the filename is of the form:
// /path/to/dir/[lang].[fontname].exp[num]
// The [lang], [fontname] and [num] fields should not have '.' characters.
// If the global parameter classify_font_name is set, its value is ... | training font and returns it in fontname, by cutting
// it out based on the expectation that the filename is of the form:
// /path/to/dir/[lang].[fontname].exp[num]
// The [lang], [fontname] and [num] fields should not have '.' characters.
// If the global parameter classify_font_name is set, its value is used instead... | strchr(basename ? basename : filename, '.') | ;
const char *lastdot = strrchr(filename, '.');
if (firstdot != lastdot && firstdot != nullptr && lastdot != nullptr) {
++firstdot;
*fontname = firstdot;
fontname->resize(lastdot - firstdot);
}
}
}
#endif
/* Add all available languages recursively.
*/
static void addAvailableLanguages... | ast_based |
<fim_prefix>));
Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting");
CHECK_EQ(variant.get_type(), Variant::NIL);
variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting", "my_nice_default_value");
CHECK_EQ(variant.get_type(), Variant::STRING);
String nam... | ));
Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting");
CHECK_EQ(variant.get_type(), Variant::NIL);
variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting", "my_nice_default_value");
CHECK_EQ(variant.get_type(), Variant::STRING);
String name = variant;... | CHECK_EQ(variant.get_type(), Variant::NIL) | ;
ProjectSettings::get_singleton()->set_setting("my_custom_setting", true);
CHECK(ProjectSettings::get_singleton()->has_setting("my_custom_setting"));
variant = ProjectSettings::get_singleton()->get_setting("my_custom_setting");
CHECK_EQ(variant.get_type(), Variant::BOOL);
bool value = variant;
CHECK_EQ(true, ... | ast_based |
<fim_prefix>lk.%d.ffn_up.weight"
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
#define LLAMA_FILE_MAGIC_GGJT 0x67676a74u // 'ggjt'
#define LLAMA_FILE_VERSION_GGJT_V3 3
#define TOKENIZER_NAME "llama"
#define UNKNOWN_TOKEN_ID 0
#define BOS_TOKEN_ID 1
#define EOS_TOK... | lk.%d.ffn_up.weight"
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
#define LLAMA_FILE_MAGIC_GGJT 0x67676a74u // 'ggjt'
#define LLAMA_FILE_VERSION_GGJT_V3 3
#define TOKENIZER_NAME "llama"
#define UNKNOWN_TOKEN_ID 0
#define BOS_TOKEN_ID 1
#define EOS_TOKEN_ID 2
///... | int vocab_size; | // vocabulary size, usually 256 (byte-level)
int seq_len; // max sequence length
} Config;
struct TransformerWeights {
// token embedding table
std::vector<float> token_embedding_table; // (vocab_size, dim)
// weights for rmsnorms
std::vector<float> rms_att_weight; // (layer, dim) rmsnorm weigh... | ast_based |
<fim_prefix>/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
... | /* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTW... | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ | /**************************************************************************/
#pragma once
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/variant/variant.h"
#include "tests/test_macros.h"
class TestProjectSettingsInternalsAccessor {
public:
static String &resource_path() {
... | 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.
Ve... | }
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> ... | }
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.length());
positions_ptr[index] = size_x + adv_per_char * k;
widths_ptr[index] = adv_per_char;
... | random |
<fim_prefix> ... | ... | TEST_ASSERT(!checkCrcAgainstRandomData(hex::crypt::crc16, 16)) | ;
TEST_SUCCESS();
};
TEST_SEQUENCE("CRC8") {
std::array golden_samples = {
// source: Sunshine's Homepage - Online CRC Calculator Javascript [http://www.sunshine2k.de/coding/javascript/crc/crc_js.html]
CrcCheck {"CRC-8-0-check", 8, 0xD5, 0xff, 0x00, true,... | ast_based |
<fim_prefix>
if (px >= limit && px < (get_size().width)) {
const Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
}
}
void AnimationBezierTrackEdit::set_play_position(real_t p_pos) {
play_posi... |
if (px >= limit && px < (get_size().width)) {
const Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
}
}
void AnimationBezierTrackEdit::set_play_position(real_t p_pos) {
play_position_pos = p... | return;
}
String base_path = String(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 (animation->track_get_type(i) != Animation::TrackType:... | random |
<fim_prefix> StringName name = p_name;
if (name == StringName()) {
name = animation;
}
ERR_FAIL_COND_MSG(frames.is_null(), vformat("There is no animation with name '%s'.", name));
ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
if (frames->g... | StringName name = p_name;
if (name == StringName()) {
name = animation;
}
ERR_FAIL_COND_MSG(frames.is_null(), vformat("There is no animation with name '%s'.", name));
ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
if (frames->get_frame_cou... | }
emit_signal(SceneStringName(animation_changed));
} else { | int end_frame = MAX(0, frames->get_frame_count(animation) - 1);
bool is_backward = std::signbit(speed_scale * custom_speed_scale);
if (p_from_end && is_backward && frame == 0 && frame_progress <= 0.0) {
set_frame_and_progress(end_frame, 1.0);
} else if (!p_from_end && !is_backward && frame == end_frame && f... | random |
<fim_prefix>page_res_it.word();
WERD_CHOICE *choice = word->best_choice;
if (choice != nullptr) {
total_blobs += choice->length() + 2;
total_length += choice->unichar_string().length() + 2;
for (int i = 0; i < word->reject_map.length(); ++i) {
if (word->reject_map[i].rejected()) {
... | page_res_it.word();
WERD_CHOICE *choice = word->best_choice;
if (choice != nullptr) {
total_blobs += choice->length() + 2;
total_length += choice->unichar_string().length() + 2;
for (int i = 0; i < word->reject_map.length(); ++i) {
if (word->reject_map[i].rejected()) {
++tota... | ClearResults(); |
if (tesseract_->pix_binary() == nullptr && !Threshold(&tesseract_->mutable_pix_binary()->pix_)) {
return false;
}
if (input_file_.empty()) {
input_file_ = kInputFile;
}
return orientation_and_script_detection(input_file_.c_str(), osr, tesseract_) > 0;
}
#endif // #ifndef DISABLED_LEGACY_ENGINE
void... | ast_based |
<fim_prefix> return CURSOR_BDIAGSIZE;
} else if (abs(scaling_selection_handles.x) == 1) {
return CURSOR_HSIZE;
} else if (abs(scaling_selection_handles.y) == 1) {
return CURSOR_VSIZE;
}
}
// Hovering the scaling box
const Vector2i rel_pos = p_pos - selection_rect.position;
if (selection_handles_rect.h... | return CURSOR_BDIAGSIZE;
} else if (abs(scaling_selection_handles.x) == 1) {
return CURSOR_HSIZE;
} else if (abs(scaling_selection_handles.y) == 1) {
return CURSOR_VSIZE;
}
}
// Hovering the scaling box
const Vector2i rel_pos = p_pos - selection_rect.position;
if (selection_handles_rect.has_point(p_p... | return CURSOR_BDIAGSIZE; | } else if (rel_pos.x < 0 || rel_pos.x > selection_rect.size.width) {
return CURSOR_HSIZE;
} else if (rel_pos.y < 0 || rel_pos.y > selection_rect.size.height) {
return CURSOR_VSIZE;
}
return CURSOR_MOVE;
}
return get_default_cursor_shape();
}
void AnimationBezierTrackEdit::set_timeline(AnimationTimeline... | random |
<fim_prefix>;
RID accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos = -1) override;
virtual RID accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos = -1) override;
bool ac... | ;
RID accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos = -1) override;
virtual RID accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos = -1) override;
bool accessibility_... | const RID &p_id | ) override;
RID accessibility_get_window_root(DisplayServer::WindowID p_window_id) const override;
void accessibility_set_window_rect(DisplayServer::WindowID p_window_id, const Rect2 &p_rect_out, const Rect2 &p_rect_in) override;
void accessibility_set_window_focused(DisplayServer::WindowID p_window_id, bool p_focu... | ast_based |
<fim_prefix>
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_sel... |
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... | undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, animation->track_get_key_time(E->get().first, E->get().second), 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");
}
undo_redo->add_do_method(this, "queue_redraw");
undo_redo->add_undo_method(this, "queue_redraw"... | random |
<fim_prefix>current control vector (but leave allocated for later)
layer_start = -1;
layer_end = -1;
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... | current control vector (but leave allocated for later)
layer_start = -1;
layer_end = -1;
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()) {
... | ggml_backend_tensor_set(tensors[il], data + off, 0, n_embd * ggml_element_size(tensors[il])); |
}
}
return true;
}
// lora
llama_adapter_lora_weight * llama_adapter_lora::get_weight(ggml_tensor * w) {
const std::string name(w->name);
const auto pos = ab_map.find(name);
if (pos != ab_map.end()) {
return &pos->second;
}
return nullptr;
}
static void llama_adapter_l... | ast_based |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.