text stringlengths 435 1.65k | prefix stringlengths 51 700 | middle stringlengths 10 200 | suffix stringlengths 50 700 | type stringclasses 2
values |
|---|---|---|---|---|
<fim_prefix> = 1.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN(frame_progress / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
remaining -= to_process;
}
i++;
if (i > fc) {
return; // Prevents freezing if to_... | = 1.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN(frame_progress / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
remaining -= to_process;
}
i++;
if (i > fc) {
return; // Prevents freezing if to_process is e... | if (centered) {
ofs -= s / 2;
} |
if (get_viewport() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) {
ofs = (ofs + Point2(0.5, 0.5)).floor();
}
Rect2 dst_rect(ofs, s);
if (hflip) {
dst_rect.size.x = -dst_rect.size.x;
}
if (vflip) {
dst_rect.size.y = -dst_rect.size.y;
}
texture->draw_rect_region(ci,... | ast_based |
<fim_prefix>#include <univalue.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/syserror.h>
#include <util/translation.h>
namespace {
class DbNotFoundError : public std::exception
{
using std::exception::exception;
};
template <typename Stream, typename Data>
bool SerializeDB(Stream& stream, c... | #include <univalue.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/syserror.h>
#include <util/translation.h>
namespace {
class DbNotFoundError : public std::exception
{
using std::exception::exception;
};
template <typename Stream, typename Data>
bool SerializeDB(Stream& stream, const Data& d... |
template <typename Data>
bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data& data)
{
// Generate random temporary filename | const uint16_t randv{FastRandomContext().rand<uint16_t>()};
std::string tmpfn = strprintf("%s.%04x", prefix, randv);
// open temp output file
fs::path pathTmp = gArgs.GetDataDirNet() / fs::u8path(tmpfn);
FILE *file = fsbridge::fopen(pathTmp, "wb");
AutoFile fileout{file};
if (fileout.IsNull... | 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.mem_buffer = NULL;
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_llama2c_output_model);
ggml_free(model... | random |
<fim_prefix>ingleton()->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(name, "my_nice_default_... | ingleton()->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(name, "my_nice_default_value");
C... | 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, value);
CHECK(ProjectSettings::get_singleton()->has_setting("my_custom_set... | ast_based |
<fim_prefix>} // namespace
std::string Channel::GetLoadBalancingPolicyName() const {
grpc_channel_info channel_info;
return GetChannelInfoField(c_channel_, &channel_info,
&channel_info.lb_policy_name);
}
std::string Channel::GetServiceConfigJSON() const {
grpc_channel_info channel_... | } // namespace
std::string Channel::GetLoadBalancingPolicyName() const {
grpc_channel_info channel_info;
return GetChannelInfoField(c_channel_, &channel_info,
&channel_info.lb_policy_name);
}
std::string Channel::GetServiceConfigJSON() const {
grpc_channel_info channel_info;
retu... | if (node == nullptr) return 0;
return node->uuid(); | }
} // namespace experimental
grpc::internal::Call Channel::CreateCallInternal(
const grpc::internal::RpcMethod& method, grpc::ClientContext* context,
grpc::CompletionQueue* cq, size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nu... | random |
<fim_prefix>layed(i) && !locked_tracks.has(i);
if (!draw_selection_handles && !draw_track) {
continue;
}
int key_count = animation->track_get_key_count(i);
for (int j = 0; j < key_count; ++j) {
float offset = animation->track_get_key_time(i, j);
float value = animation->bezier_tra... | layed(i) && !locked_tracks.has(i);
if (!draw_selection_handles && !draw_track) {
continue;
}
int key_count = animation->track_get_key_count(i);
for (int j = 0; j < key_count; ++j) {
float offset = animation->track_get_key_time(i, j);
float value = animation->bezier_track_get_key_v... | value += -scaling_selection_offset.y + (value - scaling_selection_pivot.y) * (scaling_selection_scale.y - 1); |
}
}
Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
if (draw_selection_handles && is_selected) {
selected_pos.push_back(pos);
}
if (!draw_track) {
continue;
}
Vector2 in_vec = animation->bezier_track_get_key_in... | ast_based |
<fim_prefix> }
} else {
for (const IntPair &E : selection) {
focused_keys.insert(E);
if (E.second > 0) {
IntPair previous_key = IntPair(E.first, E.second - 1);
focused_keys.insert(previous_key);
}
if (E.second < animation->track_get_key_count(E.first) - 1) {
IntPair next_... | }
} else {
for (const IntPair &E : selection) {
focused_keys.insert(E);
if (E.second > 0) {
IntPair previous_key = IntPair(E.first, E.second - 1);
focused_keys.insert(previous_key);
}
if (E.second < animation->track_get_key_count(E.first) - 1) {
IntPair next_key = IntPai... |
real_t time = animation->track_get_key_time(key_pair.first, key_pair.second);
real_t value = animation->bezier_track_get_key_value(key_pair.first, key_pair.second);
| minimum_time = MIN(time, minimum_time);
maximum_time = MAX(time, maximum_time);
minimum_value = MIN(value, minimum_value);
maximum_value = MAX(value, maximum_value);
}
float width = get_size().width - timeline->get_name_limit() - timeline->get_buttons_width();
float padding = width * 0.1;
f... | random |
<fim_prefix>l = (p_maximum_value + p_minimum_value) / 2.0;
timeline_v_zoom = target_height / ((get_size().height - timeline->get_size().height) * 0.9);
}
void AnimationBezierTrackEdit::_zoom_changed() {
queue_redraw();
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::_update_locked_tracks_after(int ... | l = (p_maximum_value + p_minimum_value) / 2.0;
timeline_v_zoom = target_height / ((get_size().height - timeline->get_size().height) * 0.9);
}
void AnimationBezierTrackEdit::_zoom_changed() {
queue_redraw();
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) {
... | locked_tracks.insert(updated_locked_tracks[i]) | ;
}
}
}
void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
if (hidden_tracks.has(p_track)) {
hidden_tracks.erase(p_track);
}
Vector<int> updated_hidden_tracks;
for (const int &E : hidden_tracks) {
updated_hidden_tracks.push_back(E);
}
hidden_tracks.clear();
for (int i = 0; i < upd... | ast_based |
<fim_prefix>td::string result = value;
gpr_free(value);
return result;
}
} // namespace
std::string Channel::GetLoadBalancingPolicyName() const {
grpc_channel_info channel_info;
return GetChannelInfoField(c_channel_, &channel_info,
&channel_info.lb_policy_name);
}
std::string Ch... | td::string result = value;
gpr_free(value);
return result;
}
} // namespace
std::string Channel::GetLoadBalancingPolicyName() const {
grpc_channel_info channel_info;
return GetChannelInfoField(c_channel_, &channel_info,
&channel_info.lb_policy_name);
}
std::string Channel::GetSe... | auto* node = grpc_channel_get_channelz_node(channel->c_channel_);
if (node == nullptr) return 0;
return node->uuid(); |
}
} // namespace experimental
grpc::internal::Call Channel::CreateCallInternal(
const grpc::internal::RpcMethod& method, grpc::ClientContext* context,
grpc::CompletionQueue* cq, size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = n... | ast_based |
<fim_prefix>image_mipmap_offset_and_dimensions(width, height, target_format, i, dst_mip_w, dst_mip_h);
// Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
ERR_FAIL_COND(dst_ofs % 8 != 0);
uint8_t *dest_mip_write = &dest_write[dst_ofs];
astcenc_image image;
image.dim_x = dst_mip_w... | image_mipmap_offset_and_dimensions(width, height, target_format, i, dst_mip_w, dst_mip_h);
// Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
ERR_FAIL_COND(dst_ofs % 8 != 0);
uint8_t *dest_mip_write = &dest_write[dst_ofs];
astcenc_image image;
image.dim_x = dst_mip_w;
image.di... | vformat("astcenc: ASTC decompression failed: %s.", astcenc_get_error_string(status)) | );
ERR_BREAK_MSG(image.dim_z > 1, "astcenc: ASTC decompression failed because this is a 3D texture, which is not supported.");
astcenc_compress_reset(context);
}
astcenc_context_free(context);
// Replace original image with compressed one.
r_img->set_data(width, height, has_mipmaps, target_format, dest_data)... | ast_based |
<fim_prefix>theme_icon(SNAME("KeyBezierSelected"));
} break;
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
Dis... | theme_icon(SNAME("KeyBezierSelected"));
} break;
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
DisplayServer::... | get_theme_font_size(SceneStringName(font_size), SNAME("Label")) | ;
const Color color = get_theme_color(SceneStringName(font_color), 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_c... | ast_based |
<fim_prefix>e_locked_tracks_after(int p_track);
void _update_hidden_tracks_after(int p_track);
virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _menu_selected(int p_index);
void _play_position_draw();
bool _is_track_displayed(int p_track_index);
bool _is_track_curves_displayed(int p_track_i... | e_locked_tracks_after(int p_track);
void _update_hidden_tracks_after(int p_track);
virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _menu_selected(int p_index);
void _play_position_draw();
bool _is_track_displayed(int p_track_index);
bool _is_track_curves_displayed(int p_track_index);
Vec... | bool box_selecting = false; |
bool box_selecting_add = false;
Vector2 box_selection_from;
Vector2 box_selection_to;
Rect2 selection_rect;
Rect2 selection_handles_rect;
bool scaling_selection = false;
Vector2i scaling_selection_handles;
Vector2 scaling_selection_scale = Vector2(1, 1);
Vector2 scaling_selection_offset;
Point2 scaling_sel... | ast_based |
<fim_prefix>#include "llama-adapter.h"
#include "llama-impl.h"
#include "llama-mmap.h"
#include "llama-model.h"
#include <map>
#include <cassert>
#include <sstream>
#include <stdexcept>
// vec
ggml_tensor * llama_adapter_cvec::tensor_for(int il) const <fim_suffix>
return tensors[il];
}
ggml_tensor * llama_ada... | #include "llama-adapter.h"
#include "llama-impl.h"
#include "llama-mmap.h"
#include "llama-model.h"
#include <map>
#include <cassert>
#include <sstream>
#include <stdexcept>
// vec
ggml_tensor * llama_adapter_cvec::tensor_for(int il) const | {
if (il < 0 || il < layer_start || il > layer_end || (size_t) il >= tensors.size()) {
return nullptr;
} |
return tensors[il];
}
ggml_tensor * llama_adapter_cvec::apply_to(ggml_context * ctx, ggml_tensor * cur, int il) const {
ggml_tensor * layer_dir = tensor_for(il);
if (layer_dir != nullptr) {
cur = ggml_add(ctx, cur, layer_dir);
}
return cur;
}
bool llama_adapter_cvec::init(const llama_m... | ast_based |
<fim_prefix>TER_TYPE));
if (adapter_type != "lora") {
throw std::runtime_error("expect adapter.type to be 'lora', but got: " + adapter_type);
}
adapter.alpha = get_kv_f32(llm_kv(LLM_KV_ADAPTER_LORA_ALPHA));
// parse alora invocation sequence vector
const auto & key ... | TER_TYPE));
if (adapter_type != "lora") {
throw std::runtime_error("expect adapter.type to be 'lora', but got: " + adapter_type);
}
adapter.alpha = get_kv_f32(llm_kv(LLM_KV_ADAPTER_LORA_ALPHA));
// parse alora invocation sequence vector
const auto & key = llm_kv(LLM... | if (arr_type != GGUF_TYPE_UINT32) {
throw std::runtime_error("invalid gguf element type for " + key);
} |
const size_t seq_len = gguf_get_arr_n(ctx_gguf.get(), kid);
const void * data = gguf_get_arr_data(ctx_gguf.get(), kid);
adapter.alora_invocation_tokens.resize(seq_len);
std::copy(
(const llama_token *)data,
(const llama_token *)data + seq_... | ast_based |
<fim_prefix>es.data(), token_types.size());
gguf_set_val_str(ctx, KV_TOKENIZER_MODEL, TOKENIZER_NAME);
gguf_set_val_str(ctx, KV_GENERAL_ARCHITECTURE, "llama");
gguf_set_val_str(ctx, KV_GENERAL_NAME, "llama");
// special tokens
gguf_set_val_u32(ctx, KV_TOKENIZER_UNK_ID, UNKNOWN_TOKEN_ID);
gguf... | es.data(), token_types.size());
gguf_set_val_str(ctx, KV_TOKENIZER_MODEL, TOKENIZER_NAME);
gguf_set_val_str(ctx, KV_GENERAL_ARCHITECTURE, "llama");
gguf_set_val_str(ctx, KV_GENERAL_NAME, "llama");
// special tokens
gguf_set_val_u32(ctx, KV_TOKENIZER_UNK_ID, UNKNOWN_TOKEN_ID);
gguf_set_val_u32... | gguf_set_val_u32(ctx, KV_FEED_FORWARD_LENGTH, model->hparams.n_ff) | ;
gguf_set_val_u32(ctx, KV_ATTENTION_HEAD_COUNT, model->hparams.n_head);
gguf_set_val_u32(ctx, KV_ATTENTION_HEAD_COUNT, model->hparams.n_head);
gguf_set_val_u32(ctx, KV_ATTENTION_HEAD_COUNT_KV, model->hparams.n_head_kv);
gguf_set_val_u32(ctx, KV_BLOCK_COUNT, model->hparams.n_layer);
gguf_set_val_u32... | ast_based |
<fim_prefix> * 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 kMaxBytesPerLine = kNumbersPerBlob * (kBytesPer64BitNumber + 1) + 1 + UNICHAR_LEN;
/**
* The recognized... | * 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 kMaxBytesPerLine = kNumbersPerBlob * (kBytesPer64BitNumber + 1) + 1 + UNICHAR_LEN;
/**
* The recognized text is ret... | int utf8_length = TextLength(&blob_count); | int total_length = blob_count * kBytesPerBoxFileLine + utf8_length + kMaxBytesPerLine;
char *result = new char[total_length];
result[0] = '\0';
int output_length = 0;
LTRResultIterator *it = GetLTRIterator();
do {
int left, top, right, bottom;
if (it->BoundingBox(RIL_SYMBOL, &left, &top, &right, &bo... | random |
<fim_prefix>ro(CAROTENE_NS::Size2D(kernel_width, kernel_height), (float*)kernel_data, kernel_step) != kernel_width * kernel_height)
return CV_HAL_ERROR_NOT_IMPLEMENTED;
break;
case CV_64F:
if(CAROTENE_NS::countNonZero(CAROTENE_NS::Size2D(kernel_width, kernel_height), (double*)kernel_data... | ro(CAROTENE_NS::Size2D(kernel_width, kernel_height), (float*)kernel_data, kernel_step) != kernel_width * kernel_height)
return CV_HAL_ERROR_NOT_IMPLEMENTED;
break;
case CV_64F:
if(CAROTENE_NS::countNonZero(CAROTENE_NS::Size2D(kernel_width, kernel_height), (double*)kernel_data, kernel_ste... | ctx->anchor_x = anchor_x | ;
ctx->anchor_y = anchor_y;
switch(operation)
{
case CV_HAL_MORPH_ERODE:
case CV_HAL_MORPH_DILATE:
ctx->operation = operation;
break;
default:
delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED;
}
switch(borderType)
{
case CV_HAL_BORDER_CONSTANT:
... | ast_based |
<fim_prefix>ama_adapter_cvec::apply(
const llama_model & model,
const float * data,
size_t len,
int32_t n_embd,
int32_t il_start,
int32_t il_end) {
const auto & hparams = model.hparams;
if (data == nullptr) {
// disable the current control vector (but lea... | ama_adapter_cvec::apply(
const llama_model & model,
const float * data,
size_t len,
int32_t n_embd,
int32_t il_start,
int32_t il_end) {
const auto & hparams = model.hparams;
if (data == nullptr) {
// disable the current control vector (but leave allocated... | layer_end = il_end | ;
for (size_t il = 1; il < hparams.n_layer; il++) {
assert(tensors[il] != nullptr);
const size_t off = n_embd * (il - 1); // buffer doesn't have data for layer 0, since it's never present
if (off + n_embd <= len) {
ggml_backend_tensor_set(tensors[il], data + off, 0, n_embd * gg... | ast_based |
<fim_prefix> src2, sz2, \
dst, sz, \
scale, \
CAROTENE_NS::CONVERT_POLICY_SATURATE), \
CV_HAL_ERROR_OK \
: CV_HAL_ERROR_NOT_IMPLEMENTED \
)
#define TEGRA_RECIPF(src2, sz2, dst, sz, w, h, scale) \
( \
... | src2, sz2, \
dst, sz, \
scale, \
CAROTENE_NS::CONVERT_POLICY_SATURATE), \
CV_HAL_ERROR_OK \
: CV_HAL_ERROR_NOT_IMPLEMENTED \
)
#define TEGRA_RECIPF(src2, sz2, dst, sz, w, h, scale) \
( \
CAROTENE... | #define cv_hal_mul8s TEGRA_MUL | #undef cv_hal_mul16u
#define cv_hal_mul16u TEGRA_MUL
#undef cv_hal_mul16s
#define cv_hal_mul16s TEGRA_MUL
#undef cv_hal_mul32s
#define cv_hal_mul32s TEGRA_MUL
#undef cv_hal_mul32f
#define cv_hal_mul32f TEGRA_MULF
//#undef cv_hal_mul64f
//#define cv_hal_mul64f TEGRA_MULF
#undef cv_hal_div8u
#define cv_hal_div8u TEGRA_DI... | random |
<fim_prefix>obs->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]; ++i) {
for (int k = 0; k < probs->ne[0]; ++k) {
flo... | obs->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]; ++i) {
for (int k = 0; k < probs->ne[0]; ++k) {
float p = get_f... | seek(0, SEEK_END);
size = tell(); |
seek(0, SEEK_SET);
}
}
size_t tell() const {
#ifdef _WIN32
__int64 ret = _ftelli64(fp);
#else
long ret = std::ftell(fp);
#endif
GGML_ASSERT(ret != -1); // this really shouldn't fail
return (size_t) ret;
}
void seek(size_t offset, int whence) {
#ifde... | ast_based |
<fim_prefix>(IntPair(p_track, idx));
emit_signal(SNAME("select_key"), idx, p_single, p_track);
queue_redraw();
}
void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (panner->gui_input(p_event)) {
accept_event();
return;
}
if (p_event->is_pressed()... | (IntPair(p_track, idx));
emit_signal(SNAME("select_key"), idx, p_single, p_track);
queue_redraw();
}
void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (panner->gui_input(p_event)) {
accept_event();
return;
}
if (p_event->is_pressed()) {
if (ED... | {
if (!read_only) {
copy_selected_keys(false);
}
accept_event(); |
}
if (ED_IS_SHORTCUT("animation_editor/paste_keys", p_event)) {
if (!read_only) {
paste_keys(-1.0, false);
}
accept_event();
}
if (ED_IS_SHORTCUT("animation_editor/delete_selection", p_event)) {
if (!read_only) {
delete_selection();
}
accept_event();
}
}
Ref<InputEventKey> key_pr... | ast_based |
<fim_prefix>eeze_time_scale = false;
public:
static Engine *get_singleton();
virtual void set_physics_ticks_per_second(int p_ips);
virtual int get_physics_ticks_per_second() const;
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
virtual int get_max_physics_steps_per_frame() const;
void ... | eeze_time_scale = false;
public:
static Engine *get_singleton();
virtual void set_physics_ticks_per_second(int p_ips);
virtual int get_physics_ticks_per_second() const;
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
virtual int get_max_physics_steps_per_frame() const;
void set_physics_... | return _physics_frames; | }
uint64_t get_process_frames() const { return _process_frames; }
bool is_in_physics_frame() const { return _in_physics; }
uint64_t get_frame_ticks() const { return _frame_ticks; }
double get_process_step() const { return _process_step; }
double get_physics_interpolation_fraction() const { return _physics_interpo... | ast_based |
<fim_prefix>n an upright page orientation).
*
* The returned array is of length equal to the number of text blocks, which may
* be less than the total number of blocks. The ordering is intended to be
* consistent with GetTextLines().
*/
void TessBaseAPI::GetBlockTextOrientations(int **block_orientation, bool **ver... | n an upright page orientation).
*
* The returned array is of length equal to the number of text blocks, which may
* be less than the total number of blocks. The ordering is intended to be
* consistent with GetTextLines().
*/
void TessBaseAPI::GetBlockTextOrientations(int **block_orientation, bool **vertical_writin... | ++num_blocks; |
}
if (!num_blocks) {
tprintf("WARNING: Found no blocks\n");
return;
}
*block_orientation = new int[num_blocks];
*vertical_writing = new bool[num_blocks];
block_it.move_to_first();
int i = 0;
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
if (!block_it.data()->... | ast_based |
<fim_prefix>ate grpc::internal::GrpcLibrary {
public:
/// Create an unset Alarm.
Alarm();
/// Destroy the given completion queue alarm, cancelling it in the process.
~Alarm() override;
/// DEPRECATED: Create and set a completion queue alarm instance associated to
/// \a cq.
/// This form is deprecated ... | ate grpc::internal::GrpcLibrary {
public:
/// Create an unset Alarm.
Alarm();
/// Destroy the given completion queue alarm, cancelling it in the process.
~Alarm() override;
/// DEPRECATED: Create and set a completion queue alarm instance associated to
/// \a cq.
/// This form is deprecated because it i... | grpc::TimePoint<T>(deadline).raw_time() | , tag);
}
/// Trigger an alarm instance on completion queue \a cq at the specified time.
/// Once the alarm expires (at \a deadline) or it's cancelled (see \a Cancel),
/// an event with tag \a tag will be added to \a cq. If the alarm expired, the
/// event's success bit will be true, false otherwise (ie, upo... | ast_based |
<fim_prefix>// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef CALIB_COMMON_HPP
#define CALIB_COMMON_HPP
#include <opencv2/core.hpp>
#include <memory>
#include <vecto... | // This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef CALIB_COMMON_HPP
#define CALIB_COMMON_HPP
#include <opencv2/core.hpp>
#include <memory>
#include <vector>
#include ... | bool showOverlayMessage(const std::string& message); |
enum InputType { Video, Pictures };
enum InputVideoSource { Camera, File };
enum TemplateType { AcirclesGrid, Chessboard, ChArUco, DoubleAcirclesGrid, CirclesGrid };
static const std::string mainWindowName = "Calibration";
static const std::string gridWindowName = "Board locations";
static co... | ast_based |
<fim_prefix>lientSession::ClientSession(const Scope& scope,
const SessionOptions& session_options) {
Session* new_session;
absl::Status status = NewSession(session_options, &new_session);
TF_CHECK_OK(status) << status;
impl_.reset(new Impl(new_session, scope.graph_as_shared_ptr()));... | lientSession::ClientSession(const Scope& scope,
const SessionOptions& session_options) {
Session* new_session;
absl::Status status = NewSession(session_options, &new_session);
TF_CHECK_OK(status) << status;
impl_.reset(new Impl(new_session, scope.graph_as_shared_ptr()));
CHECK_NOT... | options.env = Env::Default();
options.target = target; |
return options;
}
absl::Status ClientSession::Run(const std::vector<Output>& fetch_outputs,
std::vector<Tensor>* outputs) const {
return Run(FeedType{}, fetch_outputs, {}, outputs);
}
absl::Status ClientSession::Run(const FeedType& inputs,
const std... | ast_based |
<fim_prefix> samples_in = nullptr;
if (mix_rate == -1) {
mix_rate = _get_configured_mix_rate();
}
channels = get_channels();
samples_in = memnew_arr(int32_t, size_t(buffer_frames) * channels);
if (use_threads) {
thread.start(AudioDriverDummy::thread_func, this);
}
return OK;
}
void AudioDriverDummy::thr... | samples_in = nullptr;
if (mix_rate == -1) {
mix_rate = _get_configured_mix_rate();
}
channels = get_channels();
samples_in = memnew_arr(int32_t, size_t(buffer_frames) * channels);
if (use_threads) {
thread.start(AudioDriverDummy::thread_func, this);
}
return OK;
}
void AudioDriverDummy::thread_func(voi... | }
OS::get_singleton()->delay_usec(usdelay);
} | }
void AudioDriverDummy::start() {
active.set();
}
int AudioDriverDummy::get_mix_rate() const {
return mix_rate;
}
AudioDriver::SpeakerMode AudioDriverDummy::get_speaker_mode() const {
return speaker_mode;
}
void AudioDriverDummy::lock() {
mutex.lock();
}
void AudioDriverDummy::unlock() {
mutex.unlock();
}
v... | random |
<fim_prefix>culate the relative position on hover events
void _set_key_modifier_state(Ref<InputEventWithModifiers> ev, Key p_keycode);
static MouseButton _button_index_from_mask(BitField<MouseButtonMask> button_mask);
static BitField<MouseButtonMask> _android_button_mask_to_godot_button_mask(int android_button_mas... | culate the relative position on hover events
void _set_key_modifier_state(Ref<InputEventWithModifiers> ev, Key p_keycode);
static MouseButton _button_index_from_mask(BitField<MouseButtonMask> button_mask);
static BitField<MouseButtonMask> _android_button_mask_to_godot_button_mask(int android_button_mask);
void _... | void _cancel_mouse_event_info(bool p_source_mouse_relative = false); |
void _parse_all_touch(bool p_pressed, bool p_canceled = false, bool p_double_tap = false);
void _release_all_touch();
void _cancel_all_touch();
public:
void process_mouse_event(int p_event_action, int p_event_android_buttons_mask, Point2 p_event_pos, Vector2 p_delta, bool p_double_click, bool p_source_mouse_re... | ast_based |
<fim_prefix> grpc::CompletionQueue* cq, void* tag) {
TagSaver* tag_saver = new TagSaver(tag);
grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline,
cq->cq(), tag_saver);
}
bool Channel::WaitForStateChangeImpl(grpc_connectivity_state la... | grpc::CompletionQueue* cq, void* tag) {
TagSaver* tag_saver = new TagSaver(tag);
grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline,
cq->cq(), tag_saver);
}
bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,... | functor_run = &ShutdownCallback::Run; |
// Set inlineable to true since this callback is trivial and thus does not
// need to be run from the EventEngine (potentially triggering a thread
// hop). This should only be used by internal callbacks like this and not by
// user application code.
inlineable = true;
}
// TakeCQ takes ownershi... | ast_based |
<fim_prefix>raMatrix3 = cameraMatrix, distCoeffs3 = distCoeffs;
}
vector<vector<Point2f> > imgpt_right;
// step 2: calibrate (1,2) and (3,2) pairs
for( c = 2; c <= 3; c++ )
{
const vector<vector<Point2f> >& imgpt0 = c == 2 ? imagePoints2 : imagePoints3;
imgpt.clear();
imgp... | raMatrix3 = cameraMatrix, distCoeffs3 = distCoeffs;
}
vector<vector<Point2f> > imgpt_right;
// step 2: calibrate (1,2) and (3,2) pairs
for( c = 2; c <= 3; c++ )
{
const vector<vector<Point2f> >& imgpt0 = c == 2 ? imagePoints2 : imagePoints3;
imgpt.clear();
imgpt_right.clea... | {
printf("Error: not enough shared views for cameras 1 and %d\n", c);
return false;
} |
objpt.resize(imgpt.size(),objpt[0]);
Mat cameraMatrix = c == 2 ? cameraMatrix2 : cameraMatrix3;
Mat distCoeffs = c == 2 ? distCoeffs2 : distCoeffs3;
Mat R, T, E, F;
double err = stereoCalibrate(objpt, imgpt, imgpt_right, cameraMatrix1, distCoeffs1,
... | ast_based |
<fim_prefix>is the confidence (15.0 is reasonably confident)
* script_name is an ASCII string, the name of the script, e.g. "Latin"
* script_conf is confidence level in the script
* Returns true on success and writes values to each parameter as an output
*/
bool TessBaseAPI::DetectOrientationScript(int *orient_deg,... | is the confidence (15.0 is reasonably confident)
* script_name is an ASCII string, the name of the script, e.g. "Latin"
* script_conf is confidence level in the script
* Returns true on success and writes values to each parameter as an output
*/
bool TessBaseAPI::DetectOrientationScript(int *orient_deg, float *orie... | *orient_deg = orient_id * 90; | // convert quadrant to degrees
}
if (script_name) {
const char *script = osr.unicharset->get_script_from_script_id(script_id);
*script_name = script;
}
if (script_conf) {
*script_conf = osr.best_result.sconfidence;
}
return true;
}
/**
* The recognized text is returned as a char* which is... | ast_based |
<fim_prefix>
// init LLM
llama_backend_init();
llama_numa_init(params.numa);
// initialize the model
llama_model_params model_params = common_model_params_to_llama(params);
llama_model * model = llama_model_load_from_file(params.model.path.c_str(), model_params);
if (model == NULL) {
... |
// init LLM
llama_backend_init();
llama_numa_init(params.numa);
// initialize the model
llama_model_params model_params = common_model_params_to_llama(params);
llama_model * model = llama_model_load_from_file(params.model.path.c_str(), model_params);
if (model == NULL) {
fprint... |
if (ctx == NULL) { | fprintf(stderr , "%s: error: failed to create the llama_context\n" , __func__);
return 1;
}
const llama_vocab * vocab = llama_model_get_vocab(model);
const int32_t n_vocab = llama_vocab_n_tokens(vocab);
const auto get_token_rand = [n_vocab]() -> llama_token {
return std... | random |
<fim_prefix>Path);
static int32_t layerCount(const std::string &modelPath);
static bool isEmbeddingModel(const std::string &modelPath);
static auto chatTemplate(const char *modelPath) -> std::expected<std::string, std::string>;
static void setImplementationsSearchPath(const std::string &... | Path);
static int32_t layerCount(const std::string &modelPath);
static bool isEmbeddingModel(const std::string &modelPath);
static auto chatTemplate(const char *modelPath) -> std::expected<std::string, std::string>;
static void setImplementationsSearchPath(const std::string &path);
... | const std::string &buildVariant | );
static LLModel *constructGlobalLlama(const std::optional<std::string> &backend = std::nullopt);
char *(*m_getFileArch)(const char *fname);
bool (*m_isArchSupported)(const char *arch);
LLModel *(*m_construct)();
std::string_view m_modelType;
std::string_view m_buildVa... | ast_based |
<fim_prefix>ss / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
remaining -= to_process;
}
i++;
if (i > fc) {
return; // Prevents freezing if to_process is each time much less than remaining.
}
}
} break;
case NOTIFICATION_DRAW: {
if (frames.is_null() || !fra... | ss / abs_speed, remaining);
frame_progress -= to_process * abs_speed;
remaining -= to_process;
}
i++;
if (i > fc) {
return; // Prevents freezing if to_process is each time much less than remaining.
}
}
} break;
case NOTIFICATION_DRAW: {
if (frames.is_null() || !frames->has_ani... | ofs = (ofs + Point2(0.5, 0.5)).floor() | ;
}
Rect2 dst_rect(ofs, s);
if (hflip) {
dst_rect.size.x = -dst_rect.size.x;
}
if (vflip) {
dst_rect.size.y = -dst_rect.size.y;
}
texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
} break;
}
}
void AnimatedSprite2D::set_sprite_fram... | ast_based |
<fim_prefix> AccessibilityElement *other_ae = rid_owner.get_or_null(p_related_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_push_to_radio_group(ae->node, (accesskit_node_id)p_related_id.get_id());
}
void AccessibilityDriverAccessKit::acce... | AccessibilityElement *other_ae = rid_owner.get_or_null(p_related_id);
ERR_FAIL_NULL(other_ae);
ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_push_to_radio_group(ae->node, (accesskit_node_id)p_related_id.get_id());
}
void AccessibilityDriverAccessKit::accessibility_up... | ERR_FAIL_NULL(other_ae); | ERR_FAIL_COND(other_ae->window_id != ae->window_id);
_ensure_node(p_id, ae);
accesskit_node_set_active_descendant(ae->node, (accesskit_node_id)p_other_id.get_id());
}
void AccessibilityDriverAccessKit::accessibility_update_set_next_on_line(const RID &p_id, const RID &p_other_id) {
ERR_FAIL_COND_MSG(!in_accessibil... | random |
<fim_prefix> undo_redo->commit_action();
// Then attempt to move.
int index = animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(index == -1);
_clear_selection();
_select_at_anim(animation, selected_track, animation->track_get_key_time(selected_track, index), t... | undo_redo->commit_action();
// Then attempt to move.
int index = animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX);
ERR_FAIL_COND(index == -1);
_clear_selection();
_select_at_anim(animation, selected_track, animation->track_get_key_time(selected_track, index), true);
mo... |
// Box select.
if (mb->get_position().x >= limit && mb->get_position().x < get_size().width) {
box_selecting_attempt = true;
box_selecting = false; | box_selecting_add = false;
box_selection_from = mb->get_position();
return;
}
}
if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (box_selecting) {
// Do actual select.
if (!box_selecting_add) {
_clear_selection();
}
Vec... | random |
<fim_prefix>ist_changed();
queue_redraw();
}
void AnimatedSprite2D::play_backwards(const StringName &p_name) {
play(p_name, -1, true);
}
void AnimatedSprite2D::_stop_internal(bool p_reset) {
playing = false;
if (p_reset) {
custom_speed_scale = 1.0;
set_frame_and_progress(0, 0.0);
}
notify_property_list_chan... | ist_changed();
queue_redraw();
}
void AnimatedSprite2D::play_backwards(const StringName &p_name) {
play(p_name, -1, true);
}
void AnimatedSprite2D::_stop_internal(bool p_reset) {
playing = false;
if (p_reset) {
custom_speed_scale = 1.0;
set_frame_and_progress(0, 0.0);
}
notify_property_list_changed();
set_... | {
frame_speed_scale = 1.0 / _get_frame_duration();
} |
void AnimatedSprite2D::set_animation(const StringName &p_name) {
if (animation == p_name) {
return;
}
animation = p_name;
emit_signal(SceneStringName(animation_changed));
if (frames.is_null()) {
animation = StringName();
stop();
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
... | ast_based |
<fim_prefix> CHECK_EQ(variant.get_type(), Variant::STRING);
String name = variant;
CHECK_EQ(name, String());
}
TEST_CASE("[ProjectSettings] Non existing setting is null") {
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
Variant variant = ProjectSettings::get_singleton()->get_... | CHECK_EQ(variant.get_type(), Variant::STRING);
String name = variant;
CHECK_EQ(name, String());
}
TEST_CASE("[ProjectSettings] Non existing setting is null") {
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
Variant variant = ProjectSettings::get_singleton()->get_setting("not... | 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(name, "my_nice_default_value");
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
}
TEST_CASE("[ProjectSettings] Set value should be returned when retrieved") {
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("my_custom_setting"));
Variant variant = ProjectSet... | random |
<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. */
/**************************************************************************/
#include "animation_bezier_editor.h"
#include "editor/animation/animation_player_editor_plugin.h"
#include "editor/editor_node.h"
#include "editor/editor_string_nam... | random |
<fim_prefix>PI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
MutableIterator *TessBaseAPI::GetMutableIterator() {
if (tesseract_ ==... | PI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
MutableIterator *TessBaseAPI::GetMutableIterator() {
if (tesseract_ == nullptr || ... | if (tesseract_ == nullptr || (!recognition_done_ && Recognize(nullptr) < 0)) {
return nullptr;
} |
std::string text("");
const std::unique_ptr</*non-const*/ ResultIterator> it(GetIterator());
do {
if (it->Empty(RIL_PARA)) {
continue;
}
auto block_type = it->BlockType();
switch (block_type) {
case PT_FLOWING_IMAGE:
case PT_HEADING_IMAGE:
case PT_PULLOUT_IMAGE:
case... | ast_based |
<fim_prefix>v_backend_reg(cpu_dev);
auto ggml_backend_dev_get_extra_bufts_fn = (ggml_backend_dev_get_extra_bufts_t)
ggml_backend_reg_get_proc_address(cpu_reg, "ggml_backend_dev_get_extra_bufts");
if (ggml_backend_dev_get_extra_bufts_fn) {
ggml_backend_buffer_type_t * extra_buft... | v_backend_reg(cpu_dev);
auto ggml_backend_dev_get_extra_bufts_fn = (ggml_backend_dev_get_extra_bufts_t)
ggml_backend_reg_get_proc_address(cpu_reg, "ggml_backend_dev_get_extra_bufts");
if (ggml_backend_dev_get_extra_bufts_fn) {
ggml_backend_buffer_type_t * extra_bufts = ggml_bac... | str_endswith(name, "token_embd.weight") | ;
if (!w.a || !w.b) {
throw std::runtime_error("LoRA tensor pair for '" + name + "' is missing one component");
}
// device buft and device ctx
const auto * model_tensor = model.get_tensor(name.c_str());
if (!model_tensor) {
throw std::runtime_error("LoR... | ast_based |
<fim_prefix> if (thresholder_ == nullptr)
return -1;
return thresholder_->GetSourceYResolution();
}
// If flist exists, get data from there. Otherwise get data from buf.
// Seems convoluted, but is the easiest way I know of to meet multiple
// goals. Support streaming from stdin, and also work on platforms
// l... | if (thresholder_ == nullptr)
return -1;
return thresholder_->GetSourceYResolution();
}
// If flist exists, get data from there. Otherwise get data from buf.
// Seems convoluted, but is the easiest way I know of to meet multiple
// goals. Support streaming from stdin, and also work on platforms
// lacking fmemo... | unsigned page = (tessedit_page_number >= 0) ? tessedit_page_number : 0;
char pagename[MAX_PATH];
std::vector<std::string> lines;
if (!flist) { | std::string line;
for (const auto ch : *buf) {
if (ch == '\n') {
lines.push_back(line);
line.clear();
} else {
line.push_back(ch);
}
}
if (!line.empty()) {
// Add last line without terminating LF.
lines.push_back(line);
}
if (lines.empty()) {... | random |
<fim_prefix>#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool accurate_breadcrumbs = false;
#endif
int32_t gpu_idx = -1;
uint64_t _process_frames = 0;
bool _in_physics = false;
List<Singleton> singletons;
HashMap<StringName, Object *> singleton_ptrs;
bool editor_hint = false;
bool project_manager_hint ... | #if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool accurate_breadcrumbs = false;
#endif
int32_t gpu_idx = -1;
uint64_t _process_frames = 0;
bool _in_physics = false;
List<Singleton> singletons;
HashMap<StringName, Object *> singleton_ptrs;
bool editor_hint = false;
bool project_manager_hint = false;
bo... | bool freeze_time_scale = false;
| public:
static Engine *get_singleton();
virtual void set_physics_ticks_per_second(int p_ips);
virtual int get_physics_ticks_per_second() const;
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
virtual int get_max_physics_steps_per_frame() const;
void set_physics_jitter_fix(double p_thresh... | random |
<fim_prefix>***********************************************************************/
#pragma once
#include "core/input/input_event.h"
#include "core/math/rect2.h"
#include "core/os/memory.h"
#include "core/variant/array.h"
#include "tests/test_macros.h"
namespace TestInputEvent {
TEST_CASE("[InputEvent] Signal is e... | ***********************************************************************/
#pragma once
#include "core/input/input_event.h"
#include "core/math/rect2.h"
#include "core/os/memory.h"
#include "core/variant/array.h"
#include "tests/test_macros.h"
namespace TestInputEvent {
TEST_CASE("[InputEvent] Signal is emitted when ... | Ref<InputEventMouseMotion> iemm1, iemm2; |
Ref<InputEventKey> iek;
iemm1.instantiate(), iemm2.instantiate();
iek.instantiate();
iemm1->set_button_mask(MouseButtonMask::LEFT);
CHECK_FALSE(iemm1->accumulate(iemm2));
iemm2->set_button_mask(MouseButtonMask::LEFT);
CHECK(iemm1->accumulate(iemm2));
CHECK_FALSE(iemm1->accumulate(iek));
CHECK_FALSE(iemm... | ast_based |
<fim_prefix> 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=\"0." << wc << "\... | 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=\"0." << wc << "\"";
} else... | if (page_number == 0) {
idstr << prefix << "_" << counter;
} else {
idstr << prefix << "_" << page_number << "_" << counter; | }
return idstr.str();
}
///
/// Append the ALTO XML for the beginning of the document
///
bool TessAltoRenderer::BeginDocumentHandler() {
// Delay the XML output because we need the name of the image file.
begin_document = true;
return true;
}
///
/// Append the ALTO XML for the layout of the image
///
boo... | random |
<fim_prefix>positions.size(), char_positions.ptr());
accesskit_node_set_character_widths(ae->node, char_widths.size(), char_widths.ptr());
RID font_rid = TS->shaped_get_run_font_rid(p_shaped_text, i);
if (font_rid != RID()) {
CharString font_name = TS->font_get_name(font_rid).utf8();
if (font_name.length()... | positions.size(), char_positions.ptr());
accesskit_node_set_character_widths(ae->node, char_widths.size(), char_widths.ptr());
RID font_rid = TS->shaped_get_run_font_rid(p_shaped_text, i);
if (font_rid != RID()) {
CharString font_name = TS->font_get_name(font_rid).utf8();
if (font_name.length() > 0) {
... | accesskit_node_set_font_size(ae->node, TS->shaped_get_run_font_size(p_shaped_text, i)) | ;
CharString language = TS->shaped_get_run_language(p_shaped_text, i).utf8();
if (language.length() > 0) {
accesskit_node_set_language(ae->node, language.ptr());
}
accesskit_node_set_text_direction(ae->node, ACCESSKIT_TEXT_DIRECTION_LEFT_TO_RIGHT);
accesskit_rect rect;
rect.x0 = run_off_x;
rect.y0 = 0... | ast_based |
<fim_prefix>norm, "norm.weight");
ggml_set_name(model->output, "output.weight");
model->layers.resize(n_layer);
for (uint32_t i = 0; i < n_layer; ++i) {
auto & layer = model->layers[i];
std::string layers_i = "layers." + std::to_string(i);
layer.attention_norm = ... | norm, "norm.weight");
ggml_set_name(model->output, "output.weight");
model->layers.resize(n_layer);
for (uint32_t i = 0; i < n_layer; ++i) {
auto & layer = model->layers[i];
std::string layers_i = "layers." + std::to_string(i);
layer.attention_norm = ggml_new_ten... | layer.ffn_norm = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, n_embd) | ;
layer.w1 = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_ff);
layer.w2 = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_ff, n_embd);
layer.w3 = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_ff);
ggml_set_name(layer.attention_norm, (layers_i + ".attention_norm.weight").c_str());
... | ast_based |
<fim_prefix> std::string layers_i = "layers." + std::to_string(i);
layer.attention_norm = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, n_embd);
layer.wq = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_embd);
layer.wk = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_embd / n_multiqueries);
... | std::string layers_i = "layers." + std::to_string(i);
layer.attention_norm = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, n_embd);
layer.wq = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_embd);
layer.wk = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_embd / n_multiqueries);
layer.wv... | layer.w3 = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, n_embd, n_ff) | ;
ggml_set_name(layer.attention_norm, (layers_i + ".attention_norm.weight").c_str());
ggml_set_name(layer.wq, (layers_i + ".attention.wq.weight").c_str());
ggml_set_name(layer.wk, (layers_i + ".attention.wk.weight").c_str());
ggml_set_name(layer.wv, (layers_i + ".attention.wv.weight").... | ast_based |
<fim_prefix>l = (p_maximum_value + p_minimum_value) / 2.0;
timeline_v_zoom = target_height / ((get_size().height - timeline->get_size().height) * 0.9);
}
void AnimationBezierTrackEdit::_zoom_changed() {
queue_redraw();
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::_update_locked_tracks_after(int ... | l = (p_maximum_value + p_minimum_value) / 2.0;
timeline_v_zoom = target_height / ((get_size().height - timeline->get_size().height) * 0.9);
}
void AnimationBezierTrackEdit::_zoom_changed() {
queue_redraw();
play_position->queue_redraw();
}
void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) {
... | locked_tracks.insert(updated_locked_tracks[i]); |
}
}
}
void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
if (hidden_tracks.has(p_track)) {
hidden_tracks.erase(p_track);
}
Vector<int> updated_hidden_tracks;
for (const int &E : hidden_tracks) {
updated_hidden_tracks.push_back(E);
}
hidden_tracks.clear();
for (int i = 0; i < upda... | ast_based |
<fim_prefix> &default_params);
exit(0);
} else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
print_usage(argc, argv, &default_params);
exit(1);
}
}
if (invalid_param) {
fprintf(stderr, "error: invalid parameter for argume... | &default_params);
exit(0);
} else {
fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
print_usage(argc, argv, &default_params);
exit(1);
}
}
if (invalid_param) {
fprintf(stderr, "error: invalid parameter for argument: %s\n", a... | {
size_t pos = path.find_last_of("/\\");
if (pos == std::string::npos) {
return path;
} |
return path.substr(pos + 1);
}
int main(int argc, char ** argv) {
common_init();
struct train_params params = get_default_train_params();
if (!params_parse(argc, argv, ¶ms)) {
return 1;
}
Config config;
TransformerWeights weights = {};
{
LOG_INF("%s: Loading llama... | ast_based |
<fim_prefix>
*script_name = script;
}
if (script_conf) {
*script_conf = osr.best_result.sconfidence;
}
return true;
}
/**
* The recognized text is returned as a char* which is coded
* as UTF8 and must be freed with the delete [] operator.
* page_number is a 0-based page index that will appear in t... |
*script_name = script;
}
if (script_conf) {
*script_conf = osr.best_result.sconfidence;
}
return true;
}
/**
* The recognized text is returned as a char* which is coded
* as UTF8 and must be freed with the delete [] operator.
* page_number is a 0-based page index that will appear in the osd file.... | int rotate = OrientationIdToValue(orient_deg / 90);
std::stringstream stream; | // Use "C" locale (needed for float values orient_conf and script_conf).
stream.imbue(std::locale::classic());
// Use fixed notation with 2 digits after the decimal point for float values.
stream.precision(2);
stream << std::fixed << "Page number: " << page_number << "\n"
<< "Orientation in degrees: ... | random |
<fim_prefix> RIL_PARA, alto_str);
alto_str << "\n";
}
if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
alto_str << "\t\t\t\t\t\t<TextLine ID=\"" << GetID("line", page_number, lcnt) << "\"";
AddBoxToAlto(res_it.get(), RIL_TEXTLINE, alto_str);
alto_str << "\n";
}
alto_str << "\t\t\t\... | RIL_PARA, alto_str);
alto_str << "\n";
}
if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
alto_str << "\t\t\t\t\t\t<TextLine ID=\"" << GetID("line", page_number, lcnt) << "\"";
AddBoxToAlto(res_it.get(), RIL_TEXTLINE, alto_str);
alto_str << "\n";
}
alto_str << "\t\t\t\t\t\t\t<Stri... | res_it->BoundingBox(RIL_WORD, &left, &top, &right, &bottom) | ;
do {
const std::unique_ptr<const char[]> grapheme(res_it->GetUTF8Text(RIL_SYMBOL));
if (grapheme && grapheme[0] != 0) {
alto_str << HOcrEscape(grapheme.get()).c_str();
}
res_it->Next(RIL_SYMBOL);
} while (!res_it->Empty(RIL_BLOCK) && !res_it->IsAtBeginningOf(RIL_WORD));
a... | ast_based |
<fim_prefix> PAGE_RES_IT it(page_res_);
WERD_RES *word_res = it.word();
if (word_res != nullptr) {
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] == ' ') {
... | PAGE_RES_IT it(page_res_);
WERD_RES *word_res = it.word();
if (word_res != nullptr) {
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] == ' ') {
con... | tesseract_->ReSegmentByClassification(page_res_);
tesseract_->TidyUp(page_res_);
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);
}
} else {
success = false;
}
} else {
success = f... | random |
<fim_prefix> output files. Needed only for debugging. */
void TessBaseAPI::SetOutputName(const char *name) {
output_file_ = name ? name : "";
}
bool TessBaseAPI::SetVariable(const char *name, const char *value) {
if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
}
return ParamUtils::SetParam(name, v... | output files. Needed only for debugging. */
void TessBaseAPI::SetOutputName(const char *name) {
output_file_ = name ? name : "";
}
bool TessBaseAPI::SetVariable(const char *name, const char *value) {
if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
}
return ParamUtils::SetParam(name, value, SET_PA... | int *value | ) const {
auto *p = ParamUtils::FindParam<IntParam>(name, GlobalParams()->int_params,
tesseract_->params()->int_params);
if (p == nullptr) {
return false;
}
*value = (int32_t)(*p);
return true;
}
bool TessBaseAPI::GetBoolVariable(const char *name, bool *value) ... | ast_based |
<fim_prefix> void accessibility_update_set_list_item_index(const RID &p_id, int p_index) override;
void accessibility_update_set_list_item_level(const RID &p_id, int p_level) override;
void accessibility_update_set_list_item_selected(const RID &p_id, bool p_selected) override;
void accessibility_update_set_list_item... | void accessibility_update_set_list_item_index(const RID &p_id, int p_index) override;
void accessibility_update_set_list_item_level(const RID &p_id, int p_level) override;
void accessibility_update_set_list_item_selected(const RID &p_id, bool p_selected) override;
void accessibility_update_set_list_item_expanded(co... | void accessibility_update_set_num_range(const RID &p_id, double p_min, double p_max) override;
void accessibility_update_set_num_step(const RID &p_id, double p_step) override; | void accessibility_update_set_num_jump(const RID &p_id, double p_jump) override;
void accessibility_update_set_scroll_x(const RID &p_id, double p_position) override;
void accessibility_update_set_scroll_x_range(const RID &p_id, double p_min, double p_max) override;
void accessibility_update_set_scroll_y(const RID &... | random |
<fim_prefix>
// Backup Allegro state that will be modified
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
ALLEGRO_TRANSFORM last_transform = *al_get_current_transform();
ALLEGRO_TRANSFORM last_projection_transform = *al_get_current_projection_transform();
int last_clip_x, last_cl... |
// Backup Allegro state that will be modified
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
ALLEGRO_TRANSFORM last_transform = *al_get_current_transform();
ALLEGRO_TRANSFORM last_projection_transform = *al_get_current_projection_transform();
int last_clip_x, last_clip_y, last_c... |
// Render command lists
for (const ImDrawList* draw_list : draw_data->CmdLists)
{
ImVector<ImDrawVertAllegro>& vertices = bd->BufVertices; | #if ALLEGRO_HAS_DRAW_INDEXED_PRIM
vertices.resize(draw_list->VtxBuffer.Size);
for (int i = 0; i < draw_list->VtxBuffer.Size; i++)
{
const ImDrawVert* src_v = &draw_list->VtxBuffer[i];
ImDrawVertAllegro* dst_v = &vertices[i];
DRAW_VERT_IMGUI_TO_ALLEGRO(dst_v, s... | random |
<fim_prefix>trikethrough, bool p_overline) {
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);
if (p_underline) {
ac... | trikethrough, bool p_overline) {
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);
if (p_underline) {
accesskit_node... | accesskit_node_clear_strikethrough(ae->node) | ;
}
}
void AccessibilityDriverAccessKit::accessibility_update_set_text_align(const RID &p_id, HorizontalAlignment p_align) {
ERR_FAIL_COND_MSG(!in_accessibility_update, "Accessibility updates are only allowed inside the NOTIFICATION_ACCESSIBILITY_UPDATE notification.");
AccessibilityElement *ae = rid_owner.get_or_... | ast_based |
<fim_prefix> for (int32_t i = 0; i < (int32_t) batch.n_tokens; i += n_batch) {
const int32_t n_tokens = std::min(n_batch, (int32_t) (batch.n_tokens - i));
llama_batch batch_view = {
n_tokens,
batch.token + i,
nullptr,
bat... | for (int32_t i = 0; i < (int32_t) batch.n_tokens; i += n_batch) {
const int32_t n_tokens = std::min(n_batch, (int32_t) (batch.n_tokens - i));
llama_batch batch_view = {
n_tokens,
batch.token + i,
nullptr,
batch.pos ... | if (synchronize) { | llama_synchronize(ctx);
}
}
return true;
};
// warm up
{
for (int i = 0; i < 16; ++i) {
common_batch_add(batch, get_token_rand(), i, { 0 }, false);
}
if (!decode_helper(ctx, batch, ctx_params.n_batch, true)) {
LOG... | random |
<fim_prefix>(positive_prompts.size() != negative_prompts.size()) {
fprintf(stderr, "number of positive and negative prompts must be equal\n");
return 1;
}
if (positive_prompts.empty()) {
fprintf(stderr, "must provide at least one prompt pair\n");
return 1;
}
ctx_train.pos... | (positive_prompts.size() != negative_prompts.size()) {
fprintf(stderr, "number of positive and negative prompts must be equal\n");
return 1;
}
if (positive_prompts.empty()) {
fprintf(stderr, "must provide at least one prompt pair\n");
return 1;
}
ctx_train.positive_entrie... | {
fprintf(stderr, "PCA iterations must by multiply of PCA batch size\n");
return 1;
} |
callback_data cb_data;
// pass the callback to the backend scheduler
// it will be executed for each node during the graph computation
params.cb_eval = cb_eval;
params.cb_eval_user_data = &cb_data;
params.warmup = false;
print_build_info();
llama_backend_init();
llama_numa_init(... | ast_based |
<fim_prefix> "d174ab98d277d9f5a5611c2c9f419d9f"},
HashCheck { "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"57edf4a22be3c955ac49da2e2107b67a"},
};
TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::md5, golden_sampl... | "d174ab98d277d9f5a5611c2c9f419d9f"},
HashCheck { "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"57edf4a22be3c955ac49da2e2107b67a"},
};
TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::md5, golden_samples));
TE... | "A9993E364706816ABA3E25717850C26C9CD0D89D"},
HashCheck { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | "84983E441C3BD26EBAAE4AA1F95129E5E54670F1"},
};
TEST_ASSERT(!checkHashProviderAgainstGondenSamples(hex::crypt::sha1, golden_samples));
TEST_ASSERT(!checkHashVectorAgainstGondenSamples(hex::crypt::sha1, golden_samples));
TEST_SUCCESS();
};
TEST_SEQUENCE("sha224") {
std::array go... | random |
<fim_prefix> };
ggml_context * ctx = ggml_init(params);
if (!ctx) {
return nullptr;
}
ctx_map[buft] = ctx;
ctxs.emplace_back(ctx);
return ctx;
}
return it->second;
};
// make tensors
tensor... | };
ggml_context * ctx = ggml_init(params);
if (!ctx) {
return nullptr;
}
ctx_map[buft] = ctx;
ctxs.emplace_back(ctx);
return ctx;
}
return it->second;
};
// make tensors
tensors.reserve(hp... | return false; |
}
ggml_tensor * tensor = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, hparams.n_embd);
tensors.push_back(tensor);
}
// allocate tensors / buffers and zero
bufs.reserve(ctx_map.size());
for (auto it : ctx_map) {
ggml_backend_buffer_type_t buft = it.first;
ggml_context ... | ast_based |
<fim_prefix> real_t h = key[0];
h += -scaling_selection_offset.y + (h - scaling_selection_pivot.y) * (scaling_selection_scale.y - 1);
key[0] = h;
undo_redo->add_do_method(
this,
"_bezier_track_insert_key_at_anim",
animation,
E->get().first,
newpos,
key[0],
Vecto... | real_t h = key[0];
h += -scaling_selection_offset.y + (h - scaling_selection_pivot.y) * (scaling_selection_scale.y - 1);
key[0] = h;
undo_redo->add_do_method(
this,
"_bezier_track_insert_key_at_anim",
animation,
E->get().first,
newpos,
key[0],
Vector2(key[1], k... | newpos += -scaling_selection_offset.x + (newpos - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1); | undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->get().first, newpos);
}
// 5 - (undo) Reinsert keys.
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second);
Array key = animatio... | random |
<fim_prefix>> int {
// Do LLVM's initialization first, this will also transform UTF-16 to UTF-8.
Carbon::InitLLVM init_llvm(orig_argc, orig_argv);
Carbon::Testing::SetExePath(orig_argv[0]);
// Inject a flag to override the defaults for benchmarks. This can still be
// disabled by user arguments.
llvm::Sma... | > int {
// Do LLVM's initialization first, this will also transform UTF-16 to UTF-8.
Carbon::InitLLVM init_llvm(orig_argc, orig_argv);
Carbon::Testing::SetExePath(orig_argv[0]);
// Inject a flag to override the defaults for benchmarks. This can still be
// disabled by user arguments.
llvm::SmallVector<cha... | benchmark::Initialize(&argc, argv); |
absl::ParseCommandLine(argc, argv);
benchmark::RunSpecifiedBenchmarks();
benchmark::Shutdown();
return 0;
}
| ast_based |
<fim_prefix> unlockable if all requirements are unlocked.
* @param requirement Unlocalized name of the requirement
* @return Reference to the achievement
*/
Achievement& addRequirement(std::string requirement) {
m_requirements.emplace_back(std::move(requirement));
... | unlockable if all requirements are unlocked.
* @param requirement Unlocalized name of the requirement
* @return Reference to the achievement
*/
Achievement& addRequirement(std::string requirement) {
m_requirements.emplace_back(std::move(requirement));
return ... | m_visibilityRequirements.emplace_back(std::move(requirement)) | ;
return *this;
}
/**
* @brief Marks the achievement as blacked. Blacked achievements are visible but their name and description are hidden.
* @return Reference to the achievement
*/
Achievement& setBlacked() {
m_blacked = true;
r... | ast_based |
<fim_prefix>start_pos;
sel.focus.node = (accesskit_node_id)end_rid.get_id();
sel.focus.character_index = end_pos;
accesskit_node_set_text_selection(ae->node, sel);
}
void AccessibilityDriverAccessKit::accessibility_update_set_flag(const RID &p_id, DisplayServer::AccessibilityFlags p_flag, bool p_value) {
ERR_FAIL_... | start_pos;
sel.focus.node = (accesskit_node_id)end_rid.get_id();
sel.focus.character_index = end_pos;
accesskit_node_set_text_selection(ae->node, sel);
}
void AccessibilityDriverAccessKit::accessibility_update_set_flag(const RID &p_id, DisplayServer::AccessibilityFlags p_flag, bool p_value) {
ERR_FAIL_COND_MSG(!in... | accesskit_node_clear_hidden(ae->node) | ;
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_MULTISELECTABLE: {
if (p_value) {
accesskit_node_set_multiselectable(ae->node);
} else {
accesskit_node_clear_multiselectable(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_REQUIRED: {
if (p_value) {
accessk... | ast_based |
<fim_prefix> } else if (rel_pos.x >= selection_rect.size.width) {
scaling_selection_handles.x = 1;
}
}
if (selection_rect.size.height > CMP_EPSILON) {
if (rel_pos.y <= 0) {
scaling_selection_handles.y = -1;
} else if (rel_pos.y >= selection_rect.size.height) {
scaling_selection_handl... | } else if (rel_pos.x >= selection_rect.size.width) {
scaling_selection_handles.x = 1;
}
}
if (selection_rect.size.height > CMP_EPSILON) {
if (rel_pos.y <= 0) {
scaling_selection_handles.y = -1;
} else if (rel_pos.y >= selection_rect.size.height) {
scaling_selection_handles.y = 1;
... | return;
}
| // If not scaling, that means we're moving.
moving_selection_attempt = true;
moving_selection = false;
moving_selection_mouse_begin = mb->get_position();
// The pivot will be from the mouse click location, not a specific key.
moving_selection_from_key = -1;
moving_selection_from_track = selected_tr... | random |
<fim_prefix> }
} break;
case DisplayServer::AccessibilityFlags::FLAG_BUSY: {
if (p_value) {
accesskit_node_set_busy(ae->node);
} else {
accesskit_node_clear_busy(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_MODAL: {
if (p_value) {
accesskit_node_set_modal(ae->node... | }
} break;
case DisplayServer::AccessibilityFlags::FLAG_BUSY: {
if (p_value) {
accesskit_node_set_busy(ae->node);
} else {
accesskit_node_clear_busy(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_MODAL: {
if (p_value) {
accesskit_node_set_modal(ae->node);
} else... | 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(ae->node);
} else {
accesskit_node_clear_disabled(ae->node);
}
} break;
case DisplayServer::AccessibilityFlags::FLAG_CLIPS_CHILDREN: {
... | random |
<fim_prefix>on tilde crunched words.
tilde_crunch_written = false;
tesseract_->set_unlv_suspects(word);
const char *wordstr = word->best_choice->unichar_string().c_str();
const auto &lengths = word->best_choice->unichar_lengths();
int length = lengths.length();
int i = 0;
int o... | on tilde crunched words.
tilde_crunch_written = false;
tesseract_->set_unlv_suspects(word);
const char *wordstr = word->best_choice->unichar_string().c_str();
const auto &lengths = word->best_choice->unichar_lengths();
int length = lengths.length();
int i = 0;
int offset = 0;
... | *ptr++ = ' ' | ;
} else {
last_char_was_newline = false;
}
for (; i < length; offset += lengths[i++]) {
if (wordstr[offset] == ' ' || wordstr[offset] == kTesseractReject) {
*ptr++ = kUNLVReject;
last_char_was_tilde = true;
} else {
if (word->rej... | ast_based |
<fim_prefix>ng(block_num);
tsv_str += "\t" + std::to_string(par_num);
tsv_str += "\t" + std::to_string(line_num);
tsv_str += "\t" + std::to_string(word_num);
tsv_str += "\t" + std::to_string(rect_left_);
tsv_str += "\t" + std::to_string(rect_top_);
tsv_str += "\t" + std::to_string(rect_width_);
tsv_str +=... | ng(block_num);
tsv_str += "\t" + std::to_string(par_num);
tsv_str += "\t" + std::to_string(line_num);
tsv_str += "\t" + std::to_string(word_num);
tsv_str += "\t" + std::to_string(rect_left_);
tsv_str += "\t" + std::to_string(rect_top_);
tsv_str += "\t" + std::to_string(rect_width_);
tsv_str += "\t" + std:... | par_num = 0 | ;
line_num = 0;
word_num = 0;
tsv_str += "2\t" + std::to_string(page_num); // level 2 - block
tsv_str += "\t" + std::to_string(block_num);
tsv_str += "\t" + std::to_string(par_num);
tsv_str += "\t" + std::to_string(line_num);
tsv_str += "\t" + std::to_string(word_num);
Ad... | ast_based |
<fim_prefix>_.c_str(), page_res_, monitor,
training_output_file);
fclose(training_output_file);
#endif // ndef DISABLED_LEGACY_ENGINE
} else {
// Now run the main recognition.
bool wait_for_text = true;
GetBoolVariable("paragraph_text_based", &wait_for_text);
... | _.c_str(), page_res_, monitor,
training_output_file);
fclose(training_output_file);
#endif // ndef DISABLED_LEGACY_ENGINE
} else {
// Now run the main recognition.
bool wait_for_text = true;
GetBoolVariable("paragraph_text_based", &wait_for_text);
if (!wait... | Pix *TessBaseAPI::GetInputImage() {
return tesseract_->pix_original();
} |
const char *TessBaseAPI::GetInputName() {
if (!input_file_.empty()) {
return input_file_.c_str();
}
return nullptr;
}
const char *TessBaseAPI::GetDatapath() {
return tesseract_->datadir.c_str();
}
int TessBaseAPI::GetSourceYResolution() {
if (thresholder_ == nullptr)
return -1;
return thresholde... | ast_based |
<fim_prefix> suffix.size() && str.compare(str.size()-suffix.size(), suffix.size(), suffix) == 0;
};
for (ggml_tensor * cur = ggml_get_first_tensor(ctx.get()); cur; cur = ggml_get_next_tensor(ctx.get(), cur)) {
std::string name(cur->name);
if (str_endswith(name, ".lora_a")) {
replace... | suffix.size() && str.compare(str.size()-suffix.size(), suffix.size(), suffix) == 0;
};
for (ggml_tensor * cur = ggml_get_first_tensor(ctx.get()); cur; cur = ggml_get_next_tensor(ctx.get(), cur)) {
std::string name(cur->name);
if (str_endswith(name, ".lora_a")) {
replace_all(name, "... | ab_map[name] = llama_adapter_lora_weight(nullptr, cur); |
} else {
ab_map[name].b = cur;
}
} else if (str_endswith(name, "_norm.weight")) {
// TODO: add support for norm vector
// for now, we don't really care because most adapters still work fine without it
continue;
} else {
... | ast_based |
<fim_prefix> int i = 0;
while (remaining) {
// Animation speed may be changed by animation_finished or frame_changed signals.
double speed = frames->get_animation_speed(animation) * speed_scale * custom_speed_scale * frame_speed_scale;
double abs_speed = Math::abs(speed);
if (speed == 0) {
re... | int i = 0;
while (remaining) {
// Animation speed may be changed by animation_finished or frame_changed signals.
double speed = frames->get_animation_speed(animation) * speed_scale * custom_speed_scale * frame_speed_scale;
double abs_speed = Math::abs(speed);
if (speed == 0) {
return; // Do ... | emit_signal("animation_looped");
} else {
frame = last_frame;
pause(); | emit_signal(SceneStringName(animation_finished));
return;
}
} else {
frame++;
}
_calc_frame_speed_scale();
frame_progress = 0.0;
queue_redraw();
emit_signal(SceneStringName(frame_changed));
}
double to_process = MIN((1.0 - frame_progress) / abs... | random |
<fim_prefix>ch_written = false;
tesseract_->set_unlv_suspects(word);
const char *wordstr = word->best_choice->unichar_string().c_str();
const auto &lengths = word->best_choice->unichar_lengths();
int length = lengths.length();
int i = 0;
int offset = 0;
if (last_char_was_tilde... | ch_written = false;
tesseract_->set_unlv_suspects(word);
const char *wordstr = word->best_choice->unichar_string().c_str();
const auto &lengths = word->best_choice->unichar_lengths();
int length = lengths.length();
int i = 0;
int offset = 0;
if (last_char_was_tilde && word->wo... | last_char_was_newline = false | ;
}
for (; i < length; offset += lengths[i++]) {
if (wordstr[offset] == ' ' || wordstr[offset] == kTesseractReject) {
*ptr++ = kUNLVReject;
last_char_was_tilde = true;
} else {
if (word->reject_map[i].rejected()) {
*ptr++ = kUNLVSuspe... | ast_based |
<fim_prefix>_string;
}
}
return;
}
if (p_property.name == "frame") {
if (playing) {
p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY;
return;
}
p_property.hint = PROPERTY_HINT_RANGE;
if (frames->has_animation(animation) && frames->get_frame_count(animation) > 0) {
p_proper... | _string;
}
}
return;
}
if (p_property.name == "frame") {
if (playing) {
p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY;
return;
}
p_property.hint = PROPERTY_HINT_RANGE;
if (frames->has_animation(animation) && frames->get_frame_count(animation) > 0) {
p_property.hint_stri... | get_accessibility_element() | ;
ERR_FAIL_COND(ae.is_null());
Rect2 dst_rect = _get_rect();
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_IMAGE);
DisplayServer::get_singleton()->accessibility_update_set_transform(ae, get_transform());
DisplayServer::get_singleton()->accessib... | ast_based |
<fim_prefix>);
LOG_INF("%s: n_head_kv: %u\n", __func__, params->n_head_kv);
LOG_INF("%s: n_ff: %u\n", __func__, params->n_ff);
LOG_INF("%s: n_layer: %u\n", __func__, params->n_layer);
LOG_INF("%s: n_rot: %u\n", __func__, params->n_rot);
}
static void print_tensor_info(const struct ggml_conte... | );
LOG_INF("%s: n_head_kv: %u\n", __func__, params->n_head_kv);
LOG_INF("%s: n_ff: %u\n", __func__, params->n_ff);
LOG_INF("%s: n_layer: %u\n", __func__, params->n_layer);
LOG_INF("%s: n_rot: %u\n", __func__, params->n_rot);
}
static void print_tensor_info(const struct ggml_context * ctx) {
... | { LOG_INF("= [%" PRId64 "] ", total); } |
LOG_INF("float space for %s\n", ggml_get_name(t));
}
}
static void init_model(struct my_llama_model * model) {
const auto & hparams = model->hparams;
const uint32_t n_embd = hparams.n_embd;
const uint32_t n_layer = hparams.n_layer;
const uint32_t n_vocab = hparams.n_vocab;
const uin... | ast_based |
<fim_prefix>(level));
} else {
// Get bounding box from binarized imaged. Note that this could be
// differently scaled from the original image.
do {
if (page_it->BoundingBoxInternal(level, &left, &top, &right, &bottom) &&
(!text_only || PTIsTextType(page_it->BlockType()))) {
++com... | (level));
} else {
// Get bounding box from binarized imaged. Note that this could be
// differently scaled from the original image.
do {
if (page_it->BoundingBoxInternal(level, &left, &top, &right, &bottom) &&
(!text_only || PTIsTextType(page_it->BlockType()))) {
++component_count... | page_it->Begin(); |
do {
bool got_bounding_box;
if (raw_image) {
got_bounding_box = page_it->BoundingBox(level, raw_padding, &left, &top, &right, &bottom);
} else {
got_bounding_box = page_it->BoundingBoxInternal(level, &left, &top, &right, &bottom);
}
if (got_bounding_box && (!text_only || PTIsTextType(... | ast_based |
<fim_prefix>/**************************************************************************/
/* android_input_handler.cpp */<fim_suffix>/* This file is part of: */
/* GODOT ENGINE ... | /**************************************************************************/
/* android_input_handler.cpp */ | /**************************************************************************/ | /* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright... | random |
<fim_prefix>CHECK(iejm->is_action(mock_action));
CHECK(iejm->is_action_released(mock_action));
CHECK(Math::is_equal_approx(iejm->get_action_strength(mock_action), 0.0f));
iejm->set_axis_value(0.8f);
// Since deadzone is 0.5, action_strength grows linearly from 0.5 to 1.0.
CHECK(Math::is_equal_approx(iejm->get_ac... | CHECK(iejm->is_action(mock_action));
CHECK(iejm->is_action_released(mock_action));
CHECK(Math::is_equal_approx(iejm->get_action_strength(mock_action), 0.0f));
iejm->set_axis_value(0.8f);
// Since deadzone is 0.5, action_strength grows linearly from 0.5 to 1.0.
CHECK(Math::is_equal_approx(iejm->get_action_strengt... | transform = transform.translated(Vector2(2.0f, 3.0f)); |
Ref<InputEventMouseMotion> iemm2 = iemm1->xformed_by(transform);
CHECK(iemm2->get_position().is_equal_approx(Vector2(2.0f, 3.0f)));
}
} // namespace TestInputEvent
| ast_based |
<fim_prefix>
Ref<Texture2D> t;
if (animation) {
t = frames->get_frame_texture(animation, frame);
}
return t.is_valid();
}
#endif // DEBUG_ENABLED
Rect2 AnimatedSprite2D::get_anchorable_rect() const {
return _get_rect();
}
Rect2 AnimatedSprite2D::_get_rect() const {
if (frames.is_null() || !frames->has_animati... |
Ref<Texture2D> t;
if (animation) {
t = frames->get_frame_texture(animation, frame);
}
return t.is_valid();
}
#endif // DEBUG_ENABLED
Rect2 AnimatedSprite2D::get_anchorable_rect() const {
return _get_rect();
}
Rect2 AnimatedSprite2D::_get_rect() const {
if (frames.is_null() || !frames->has_animation(animation... | return Rect2(ofs, s); |
}
void AnimatedSprite2D::_validate_property(PropertyInfo &p_property) const {
if (frames.is_null()) {
return;
}
if (!Engine::get_singleton()->is_editor_hint()) {
if (p_property.name == "frame" && playing) {
p_property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY;
}
return;
}
if (p_property... | ast_based |
<fim_prefix> stream.precision(2);
stream << std::fixed << "Page number: " << page_number << "\n"
<< "Orientation in degrees: " << orient_deg << "\n"
<< "Rotate: " << rotate << "\n"
<< "Orientation confidence: " << orient_conf << "\n"
<< "Script: " << script_name << "\n"
<... | stream.precision(2);
stream << std::fixed << "Page number: " << page_number << "\n"
<< "Orientation in degrees: " << orient_deg << "\n"
<< "Rotate: " << rotate << "\n"
<< "Orientation confidence: " << orient_conf << "\n"
<< "Script: " << script_name << "\n"
<< "Script co... | }
if (pt != conf) {
sum /= pt - conf;
} | delete[] conf;
return sum;
}
/** Returns an array of all word confidences, terminated by -1. */
int *TessBaseAPI::AllWordConfidences() {
if (tesseract_ == nullptr || (!recognition_done_ && Recognize(nullptr) < 0)) {
return nullptr;
}
int n_word = 0;
PAGE_RES_IT res_it(page_res_);
for (res_it.restart_... | random |
<fim_prefix> calcChessboardCorners(boardSize, squareSize, objpt[0]);
vector<Mat> rvecs, tvecs;
for( c = 1; c <= 3; c++ )
{
const vector<vector<Point2f> >& imgpt0 = c == 1 ? imagePoints1 : c == 2 ? imagePoints2 : imagePoints3;
imgpt.clear();
int N = 0;
for( i = 0; i < (int)... | calcChessboardCorners(boardSize, squareSize, objpt[0]);
vector<Mat> rvecs, tvecs;
for( c = 1; c <= 3; c++ )
{
const vector<vector<Point2f> >& imgpt0 = c == 1 ? imagePoints1 : c == 2 ? imagePoints2 : imagePoints3;
imgpt.clear();
int N = 0;
for( i = 0; i < (int)imgpt0.size(... | Mat::eye(3, 3, CV_64F) | ;
if( flags & CALIB_FIX_ASPECT_RATIO )
cameraMatrix.at<double>(0,0) = aspectRatio;
Mat distCoeffs = Mat::zeros(5, 1, CV_64F);
double err = calibrateCamera(objpt, imgpt, imageSize, cameraMatrix,
distCoeffs, rvecs, tvecs,
flags|CALIB_FI... | ast_based |
<fim_prefix> }
}
}
void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
if (hidden_tracks.has(p_track)) {
hidden_tracks.erase(p_track);
}
Vector<int> updated_hidden_tracks;
for (const int &E : hidden_tracks) {
updated_hidden_tracks.push_back(E);
}
hidden_tracks.clear();
for (int i = ... | }
}
}
void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
if (hidden_tracks.has(p_track)) {
hidden_tracks.erase(p_track);
}
Vector<int> updated_hidden_tracks;
for (const int &E : hidden_tracks) {
updated_hidden_tracks.push_back(E);
}
hidden_tracks.clear();
for (int i = 0; i < updat... | selection.clear();
emit_signal(SNAME("clear_selection"));
queue_redraw();
} |
void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::HandleMode p_mode, bool p_auto) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Update Selected Key Handles"), UndoRedo::MERGE_DISABLE, animation.ptr());
for (SelectionSet::Element ... | random |
<fim_prefix> const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(1)) < eps)
mCalibFlags |= cv::CALIB_FIX_K2;
}
if(!(mCalibFlags & cv::CALIB_FIX_K3)) {
const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(4)) <... | const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(1)) < eps)
mCalibFlags |= cv::CALIB_FIX_K2;
}
if(!(mCalibFlags & cv::CALIB_FIX_K3)) {
const double eps = 0.005;
if(fabs(mCalibData->distCoeffs.at<double>(4)) < eps)
... | return std::max(mCalibData->imagePoints.size(), mCalibData->allCharucoCorners.size()) > mMinFramesNum;
} |
bool calib::calibController::getConfidenceIntrervalsState() const
{
return mConfIntervalsState;
}
bool calib::calibController::getRMSState() const
{
return mCalibData->totalAvgErr < 0.5;
}
int calib::calibController::getNewFlags() const
{
return mCalibFlags;
}
//////////////////// calibDataController
... | random |
<fim_prefix> if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
}
return ParamUtils::SetParam(name, value, SET_PARAM_CONSTRAINT_NON_INIT_ONLY,
tesseract_->params());
}
bool TessBaseAPI::SetDebugVariable(const char *name, const char *value) {
if (tesseract_ == nullptr) {
... | if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
}
return ParamUtils::SetParam(name, value, SET_PARAM_CONSTRAINT_NON_INIT_ONLY,
tesseract_->params());
}
bool TessBaseAPI::SetDebugVariable(const char *name, const char *value) {
if (tesseract_ == nullptr) {
tesseract... | if (p == nullptr) {
return false;
} | *value = (int32_t)(*p);
return true;
}
bool TessBaseAPI::GetBoolVariable(const char *name, bool *value) const {
auto *p = ParamUtils::FindParam<BoolParam>(name, GlobalParams()->bool_params,
tesseract_->params()->bool_params);
if (p == nullptr) {
return false;
... | random |
<fim_prefix> /**
* @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 u... | /**
* @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 c... | [[nodiscard]] bool isUnlocked() const {
return m_progress == m_maxProgress;
} |
/**
* @brief Sets the description of the achievement
* @param description Description of the achievement
* @return Reference to the achievement
*/
Achievement& setDescription(std::string description) {
m_unlocalizedDescription = std::move(description);
... | ast_based |
<fim_prefix>S,
vformat("astcenc: ASTC image compression failed: %s.", astcenc_get_error_string(status)));
astcenc_compress_reset(context);
}
astcenc_context_free(context);
// Replace original image with compressed one.
r_img->set_data(width, height, has_mipmaps, target_format, dest_data);
print_verbose(v... | S,
vformat("astcenc: ASTC image compression failed: %s.", astcenc_get_error_string(status)));
astcenc_compress_reset(context);
}
astcenc_context_free(context);
// Replace original image with compressed one.
r_img->set_data(width, height, has_mipmaps, target_format, dest_data);
print_verbose(vformat("astc... | unsigned int block_y = 0; |
switch (src_format) {
case Image::FORMAT_ASTC_4x4: {
block_x = 4;
block_y = 4;
is_hdr = false;
} break;
case Image::FORMAT_ASTC_4x4_HDR: {
block_x = 4;
block_y = 4;
is_hdr = true;
} break;
case Image::FORMAT_ASTC_8x8: {
block_x = 8;
block_y = 8;
is_hdr = false;
} break;
case ... | ast_based |
<fim_prefix>#include "arg.h"
#include "common.h"
#include "log.h"
#include "llama.h"
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
static void print_usage(int, char ** argv) {
LOG("\nexample usage:\n");
<fim_suffix>
LOG("\n");
}
int main(int argc, char ** argv) {
common_p... | #include "arg.h"
#include "common.h"
#include "log.h"
#include "llama.h"
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
static void print_usage(int, char ** argv) {
LOG("\nexample usage:\n");
| LOG("\n %s -m model.gguf -p \"Hello my name is\" -n 32 -np 4\n", argv[0]); |
LOG("\n");
}
int main(int argc, char ** argv) {
common_params params;
params.prompt = "Hello my name is";
params.n_predict = 32;
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMMON, print_usage)) {
return 1;
}
common_init();
// number of parallel batches
i... | ast_based |
<fim_prefix>
/** Warps depth or RGB-D image by reprojecting it in 3d, applying Rt transformation
* and then projecting it back onto the image plane.
* This function can be used to visualize the results of the Odometry algorithm.
* @param depth Depth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
* @para... |
/** Warps depth or RGB-D image by reprojecting it in 3d, applying Rt transformation
* and then projecting it back onto the image plane.
* This function can be used to visualize the results of the Odometry algorithm.
* @param depth Depth data, should be 1-channel CV_16U, CV_16S, CV_32F or CV_64F
* @param image RGB ... | * @param warpedDepth The warped depth data (optional)
* @param warpedImage The warped RGB image (optional)
* @param warpedMask The mask of valid pixels in warped image (optional)
*/ | CV_EXPORTS_W void warpFrame(InputArray depth, InputArray image, InputArray mask, InputArray Rt, InputArray cameraMatrix,
OutputArray warpedDepth = noArray(), OutputArray warpedImage = noArray(), OutputArray warpedMask = noArray());
enum RgbdPlaneMethod
{
RGBD_PLANE_METHOD_DEFAULT
};
/*... | random |
<fim_prefix>R_LORA_ALPHA));
// parse alora invocation sequence vector
const auto & key = llm_kv(LLM_KV_ADAPTER_ALORA_INVOCATION_TOKENS);
const int kid = gguf_find_key(ctx_gguf.get(), key.c_str());
if (kid >= 0) {
if (gguf_get_kv_type(ctx_gguf.get(), kid) != GGUF_TYPE_ARRAY) ... | R_LORA_ALPHA));
// parse alora invocation sequence vector
const auto & key = llm_kv(LLM_KV_ADAPTER_ALORA_INVOCATION_TOKENS);
const int kid = gguf_find_key(ctx_gguf.get(), key.c_str());
if (kid >= 0) {
if (gguf_get_kv_type(ctx_gguf.get(), kid) != GGUF_TYPE_ARRAY) {
... | const void * data = gguf_get_arr_data(ctx_gguf.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());
// ... | ast_based |
<fim_prefix> std::stringstream ss;
ss << val;
return ss.str();
}
static std::vector<std::string> ctrlvec_load_prompt_file(std::string path, bool skip_empty_lines) {
std::vector<std::string> output;
std::ifstream file(path);
if (!file.is_open()) {
fprintf(stderr, "error: unable to open fi... | std::stringstream ss;
ss << val;
return ss.str();
}
static std::vector<std::string> ctrlvec_load_prompt_file(std::string path, bool skip_empty_lines) {
std::vector<std::string> output;
std::ifstream file(path);
if (!file.is_open()) {
fprintf(stderr, "error: unable to open file: %s\n", p... |
static bool cb_eval(struct ggml_tensor * t, bool ask, void * user_data) {
auto * cb_data = (callback_data *) user_data;
static const char * l_out_name = "l_out"; | const bool is_l_out = strncmp(t->name, l_out_name, strlen(l_out_name)) == 0;
if (ask) {
return is_l_out;
}
if (!is_l_out || t->ne[1] != cb_data->n_tokens) {
return true;
}
// save the tensor to current context
cb_data->save_tensor_for_layer(t);
return true;
}
static b... | random |
<fim_prefix> */
llmodel_model llmodel_model_create2(const char *model_path, const char *backend, const char **error);
/**
* Destroy a llmodel instance.
* Recognises correct model type using type info
* @param model a pointer to a llmodel_model instance.
*/
void llmodel_model_destroy(llmodel_model model);
/**
* E... | */
llmodel_model llmodel_model_create2(const char *model_path, const char *backend, const char **error);
/**
* Destroy a llmodel instance.
* Recognises correct model type using type info
* @param model a pointer to a llmodel_model instance.
*/
void llmodel_model_destroy(llmodel_model model);
/**
* Estimate RAM ... | */
size_t llmodel_required_mem(llmodel_model model, const char *model_path, int n_ctx, int ngl);
| /**
* Load a model from a file.
* @param model A pointer to the llmodel_model instance.
* @param model_path A string representing the path to the model file.
* @param n_ctx Maximum size of context window
* @param ngl Number of GPU layers to use (Vulkan)
* @return true if the model was loaded successfully, false o... | random |
<fim_prefix>en() const = 0;
virtual bool evalTokens(int32_t nPast, std::span<const Token> tokens) const = 0;
virtual void shiftContext(const PromptContext &promptCtx, int32_t *nPast) = 0;
virtual int32_t inputLength() const = 0;
virtual int32_t computeModelInputPosition(std::span<const Token> input) con... | en() const = 0;
virtual bool evalTokens(int32_t nPast, std::span<const Token> tokens) const = 0;
virtual void shiftContext(const PromptContext &promptCtx, int32_t *nPast) = 0;
virtual int32_t inputLength() const = 0;
virtual int32_t computeModelInputPosition(std::span<const Token> input) const = 0;
... | return -1; |
}
virtual int32_t layerCount(std::string const &modelPath) const
{
(void)modelPath;
return -1;
}
virtual auto chatTemplate(const char *modelPath) const -> std::expected<std::string, std::string>
{
(void)modelPath;
return std::unexpected("not implemented");
... | ast_based |
<fim_prefix> }
// 2 - Remove overlapped keys.
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t newtime = animation->track_get_key_time(E->get().first, E->get().second);
newtime += -scaling_selection_offset.x + (newtime - scaling_selection_pivot.x) * (scaling_selection_scale.x... | }
// 2 - Remove overlapped keys.
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
real_t newtime = animation->track_get_key_time(E->get().first, E->get().second);
newtime += -scaling_selection_offset.x + (newtime - scaling_selection_pivot.x) * (scaling_selection_scale.x - 1);
... | amr.key = animation->track_get_key_value(E->get().first, idx); | amr.track = E->get().first;
amr.time = newtime;
to_restore.push_back(amr);
to_restore_handle_modes.push_back(animation->bezier_track_get_key_handle_mode(E->get().first, idx));
}
// 3 - Scale the keys (re-insert them).
for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) {
r... | random |
<fim_prefix>_pivot && time_delta > CMP_EPSILON) || (snapped_time < moving_selection_pivot && time_delta < -CMP_EPSILON)) {
time_offset = snapped_time - moving_selection_pivot;
}
float moving_selection_begin_value;
if (moving_selection_from_key == -1) {
moving_selection_begin_value = (get_size().height... | _pivot && time_delta > CMP_EPSILON) || (snapped_time < moving_selection_pivot && time_delta < -CMP_EPSILON)) {
time_offset = snapped_time - moving_selection_pivot;
}
float moving_selection_begin_value;
if (moving_selection_from_key == -1) {
moving_selection_begin_value = (get_size().height / 2.0 - mov... | additional_moving_handle_rights.clear(); |
queue_redraw();
}
if (box_selecting_attempt && mm.is_valid()) {
if (!box_selecting) {
box_selecting = true;
box_selecting_add = mm->is_shift_pressed();
}
box_selection_to = mm->get_position();
queue_redraw();
}
if (scaling_selection && mm.is_valid() && !read_only) {
Point2 mp = mm->get_positi... | ast_based |
<fim_prefix>:set_frame);
ClassDB::bind_method(D_METHOD("get_frame"), &AnimatedSprite2D::get_frame);
ClassDB::bind_method(D_METHOD("set_frame_progress", "progress"), &AnimatedSprite2D::set_frame_progress);
ClassDB::bind_method(D_METHOD("get_frame_progress"), &AnimatedSprite2D::get_frame_progress);
ClassDB::bind_me... | :set_frame);
ClassDB::bind_method(D_METHOD("get_frame"), &AnimatedSprite2D::get_frame);
ClassDB::bind_method(D_METHOD("set_frame_progress", "progress"), &AnimatedSprite2D::set_frame_progress);
ClassDB::bind_method(D_METHOD("get_frame_progress"), &AnimatedSprite2D::get_frame_progress);
ClassDB::bind_method(D_METHO... | ADD_SIGNAL(MethodInfo("sprite_frames_changed")) | ;
ADD_SIGNAL(MethodInfo("animation_changed"));
ADD_SIGNAL(MethodInfo("frame_changed"));
ADD_SIGNAL(MethodInfo("animation_looped"));
ADD_SIGNAL(MethodInfo("animation_finished"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "sprite_frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_spri... | ast_based |
<fim_prefix>gets(pagename, sizeof(pagename), flist) == nullptr) {
break;
}
} else {
if (page >= lines.size()) {
break;
}
snprintf(pagename, sizeof(pagename), "%s", lines[page].c_str());
}
chomp_string(pagename);
Pix *pix = pixRead(pagename);
if (pix == nullptr... | gets(pagename, sizeof(pagename), flist) == nullptr) {
break;
}
} else {
if (page >= lines.size()) {
break;
}
snprintf(pagename, sizeof(pagename), "%s", lines[page].c_str());
}
chomp_string(pagename);
Pix *pix = pixRead(pagename);
if (pix == nullptr) {
tp... | if (renderer && !renderer->EndDocument()) {
return false;
} |
return true;
}
bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data, size_t size, const char *filename,
const char *retry_config, int timeout_millisec,
TessResultRenderer *renderer,
... | ast_based |
<fim_prefix>roperty_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 autoplay after the node has been added to the scene has no effec... | roperty_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 autoplay after the node has been added to the scene has no effect.");
}
a... | frames->get_animation_names() | .has(name), vformat("There is no animation with name '%s'.", name));
if (frames->get_frame_count(name) == 0) {
return;
}
playing = true;
custom_speed_scale = p_custom_scale;
if (name != animation) {
animation = name;
int end_frame = MAX(0, frames->get_frame_count(animation) - 1);
if (p_from_end) {
s... | ast_based |
<fim_prefix> EXPECT_TRUE(ocr_box.major_overlap(truth_box));
// Also check that the symbol text matches the box text.
char *symbol_text = it->GetUTF8Text(tesseract::RIL_SYMBOL);
EXPECT_STREQ(box_text.c_str(), symbol_text);
delete[] symbol_text;
} while (it->Next(tesseract::RIL_SYMBOL));
... | EXPECT_TRUE(ocr_box.major_overlap(truth_box));
// Also check that the symbol text matches the box text.
char *symbol_text = it->GetUTF8Text(tesseract::RIL_SYMBOL);
EXPECT_STREQ(box_text.c_str(), symbol_text);
delete[] symbol_text;
} while (it->Next(tesseract::RIL_SYMBOL));
delete i... | {
VerifyBoxesAndText("trainingital.tif", kTruthTextWords, "trainingital.box", false);
} |
// Tests line-level applyboxes on normal Times New Roman.
TEST_F(ApplyBoxTest, TimesLineLevel) {
VerifyBoxesAndText("trainingtimesline.tif", kTruthTextLine, "trainingtimes.box", true);
}
// Tests line-level applyboxes on italic Times New Roman.
TEST_F(ApplyBoxTest, ItalLineLevel) {
VerifyBoxesAndText("trainingit... | ast_based |
<fim_prefix>ing all individual updates
ALLEGRO_BITMAP* gpu_bitmap = (ALLEGRO_BITMAP*)(intptr_t)tex->TexID;
ALLEGRO_LOCKED_REGION* locked_region = al_lock_bitmap_region(gpu_bitmap, r.x, r.y, r.w, r.h, al_get_bitmap_format(gpu_bitmap), ALLEGRO_LOCK_WRITEONLY);
IM_ASSERT(locked_region && "Backend f... | ing all individual updates
ALLEGRO_BITMAP* gpu_bitmap = (ALLEGRO_BITMAP*)(intptr_t)tex->TexID;
ALLEGRO_LOCKED_REGION* locked_region = al_lock_bitmap_region(gpu_bitmap, r.x, r.y, r.w, r.h, al_get_bitmap_format(gpu_bitmap), ALLEGRO_LOCK_WRITEONLY);
IM_ASSERT(locked_region && "Backend failed to upd... | ALLEGRO_BITMAP* backend_tex = (ALLEGRO_BITMAP*)(intptr_t)tex->TexID; |
if (backend_tex)
al_destroy_bitmap(backend_tex);
// Clear identifiers and mark as destroyed (in order to allow e.g. calling InvalidateDeviceObjects while running)
tex->SetTexID(ImTextureID_Invalid);
tex->SetStatus(ImTextureStatus_Destroyed);
}
}
void ImGui_ImplAllegro5... | ast_based |
<fim_prefix>;
return rid;
}
RID AccessibilityDriverAccessKit::accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos) {
AccessibilityElement *parent_ae = rid_owner.get_or_null(p_parent_rid);
ERR_FAIL_NULL_V(parent_ae, RID());
WindowData... | ;
return rid;
}
RID AccessibilityDriverAccessKit::accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos) {
AccessibilityElement *parent_ae = rid_owner.get_or_null(p_parent_rid);
ERR_FAIL_NULL_V(parent_ae, RID());
WindowData *wd = windo... | parent_ae->children.push_back(root_rid) | ;
} else {
parent_ae->children.insert(p_insert_pos, root_rid);
}
wd->update.insert(root_rid);
float text_width = 0;
float text_height = p_min_height;
Vector<int32_t> words;
int64_t run_count = 0; // Note: runs in visual order.
const Glyph *gl = nullptr;
int64_t gl_count = 0;
int64_t gl_index = 0;
float ru... | ast_based |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.