text string | label_name string | labels int64 |
|---|---|---|
generate_plane_model(buffer, distance_threshold)
)
// get the best plane-model from all iterations (highest ranking)
.max_by(|(x, _y), (a, _b)| x.ranking.cmp(&a.ranking))
.unwrap()
}
/// Ransac Line Segmentation in parallel.
/// Returns the line with the highest rating/most ... | Rust | 0 |
import torch
import torch.nn as nn
import pdb
CLIPMIN = 1e-4
def round_ste(x: torch.Tensor):
"""
Implement Straight-Through Estimator for rounding operation.
"""
return (x.round() - x).detach() + x
def clamp_ste(x: torch.Tensor, min, max):
return (x.clamp(min,max) - x).detach() + x
def clamp_... | Python | 1 |
from modules.model.ChromaModel import ChromaModel
from modules.modelLoader.BaseModelLoader import BaseModelLoader
from modules.modelLoader.chroma.ChromaEmbeddingLoader import ChromaEmbeddingLoader
from modules.modelLoader.chroma.ChromaLoRALoader import ChromaLoRALoader
from modules.modelLoader.chroma.ChromaModelLoader ... | Python | 1 |
BIT_A {
#[doc = "0: Override the default values for NRF_1Mbit mode."]
OVERRIDE = 0,
#[doc = "1: Do not override the default values for NRF_1Mbit mode."]
NOTOVERRIDE = 1,
}
impl From<NRF_1MBIT_A> for bool {
#[inline(always)]
fn from(variant: NRF_1MBIT_A) -> Self {
variant as u8 != 0
}... | Rust | 0 |
import pybullet as p
from scipy.spatial.transform import Rotation as R
import math
from pb_ompl import PbOMPLRobot
class MyPlanarRobot(PbOMPLRobot):
def __init__(self, id) -> None:
self.id = id
self.num_dim = 7
self.joint_idx=[0,1,2,3]
self.reset()
self.joint_bounds = []
... | Python | 1 |
def calc_deceleration_rate(initial_velocity, final_velocity, time):
"""
Calculates the deceleration rate given the initial and final velocities, and time period.
Parameters:
initial_velocity (float): The starting velocity in units per time (e.g., meters per second).
final_velocity (float): The endi... | Python | 1 |
"""
Control-related nodes: PINN Estimator, Voice Control, Advanced Control
""" | Python | 1 |
character_data.behavior.start_event_draw_text = now_event_draw.text
climax_draw = settlement_pleasant_sensation(character_id)
player_data: game_type.Character = cache.character_data[0]
if (not character_id) or (player_data.target_character_id == character_id):
if now_event_draw.text != "":
... | Python | 1 |
from __future__ import annotations
from mteb.abstasks.AbsTaskBitextMining import AbsTaskBitextMining
from mteb.abstasks.TaskMetadata import TaskMetadata
class NorwegianCourtsBitextMining(AbsTaskBitextMining):
metadata = TaskMetadata(
name="NorwegianCourtsBitextMining",
dataset={
"path... | Python | 1 |
pairs = [[1, 1],[2, 2],[3, 3],[4, 4]]
same_count = 0
for x,y in pairs:
if x == y:
same_count = same_count + 1
print(same_count)
#python中for循环可以遍历数组,或者是range整数
#for name in range
#name如果有两个变量,那么会直接遍历到数组中的数组
range[-2, 2]
# Length: ending value - starting value
# 元素的顺序:序号 + 起始值
list(range(-2, 2))
# >>> [-2,... | Python | 1 |
r m in middlewares {
match m.capability_post_invoke(cur_resp) {
Ok(ir) => cur_resp = ir.clone(),
Err(e) => {
error!("Capability middleware post-invoke failure: {}", e);
return Err(e);
}
}
}
Ok(cur_resp)
}
/// Executes a chain o... | Rust | 0 |
) {
self.pc = addr;
}
pub fn dump(&self, bus: &Bus) {
use op_code::OP_NAMES;
print!("{:04X} ", self.pc);
let mut pc = self.pc;
let op = bus.inspect(pc) as usize;
let name = OP_NAMES[op];
pc += 1;
match ADDR_MODES[op] {
AddrMode::IM... | Rust | 0 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 1 |
link_metadata() {
Ok(v) => v,
Err(err) => {
errors.push(err);
continue;
}
};
if meta.is_dir() {
directories.push(path);
continue;
}
log::error!("Deleting: {:?}", &path);
match remove_fil... | Rust | 0 |
! {
{
let branchtracker = #branchtracker;
let output = #output;
let deps = #deps;
tokio::spawn(async move {
Self::#next_task_name(branchtracker, output, deps).await;
});
}
}
}
fn convert_vec_string_to_vec_task_name(nodes: &... | Rust | 0 |
,
_ => panic!("Invalid digit: {}", ch),
}
}
}
// impl Digit {
// pub(crate) fn from_char(ch: char) -> Digit {
// }
// }
pub(crate) fn digit(i: &str, ptr: Pointer) -> Result<(&str, Pointer, Digit), ParseError> {
let (i, ptr) = whitespace(i, ptr);
if let Some(ch) = i.chars().next()... | Rust | 0 |
const RED: Color = Color { code: 'c', name: "red" };
pub const LIGHT_PURPLE: Color = Color { code: 'd', name: "light_purple" };
pub const YELLOW: Color = Color { code: 'e', name: "yellow" };
pub const WHITE: Color = Color { code: 'f', name: "white" };
pub const OBFUSCATED: Color = Color { code: '... | Rust | 0 |
s shape (N, 4 * num_classes). Note N = num_anchors * W * H when
rois is a grid of anchors. Offset encoding follows [1]_.
means (Sequence[float]): Denormalizing means for delta coordinates
stds (Sequence[float]): Denormalizing standard deviation for delta
coordinates
max_s... | Python | 1 |
se):
@classmethod
def _fixture_setup(cls):
super()._fixture_setup()
cls.plan_1 = TestPlanFactory()
cls.plan_2 = TestPlanFactory(parent=cls.plan_1)
cls.plan_3 = TestPlanFactory(parent=cls.plan_1)
cls.plan_4 = TestPlanFactory(parent=cls.plan_2)
def test_tree_returns_d... | Python | 1 |
"INTEL486_A_ONLY",
"INTEL386_486_ONLY",
"IA64",
"X64",
"ADX",
"AES",
"AVX",
"AVX2",
"AVX512_4FMAPS",
"AVX512_4VNNIW",
"AVX512_BF16",
"AVX512_BITALG",
"AVX512_IFMA",
"AVX512_VBMI",
"AVX512_VBMI2",
"AVX512_VNNI",
"AVX512_VP2INTERSECT",
"AVX512_VPOPCNTDQ",
"AVX512BW",
"AVX512CD",
"AVX512DQ",
"AVX512E... | Rust | 0 |
let private_key: Vec<u8> = vec![
40, 185, 109, 70, 134, 119, 123, 37, 190, 254, 232, 186, 106, 48, 213, 63, 133, 223, 167, 126, 159, 43, 178, 4,
190, 217, 52, 66, 92, 63, 69, 84,
];
let public_key: Vec<u8> = vec![
212, 151, 158, 35, 16, 178, 19, 27, 83, 109, 212, 138, 141, 134, 122, 246, 1... | Rust | 0 |
pred1 + pred2, dim=1) )
loss_D2, reg2 = self.D2.calc_dis_loss( self.D2, input_fake = F.softmax(pred_target2, dim=1), input_real = F.softmax(0.5*pred1 + pred2, dim=1) )
loss = loss_D1 + loss_D2
if self.fp16:
with amp.scale_loss(loss, [self.dis1_opt, self.dis2_opt]... | Python | 1 |
t:
sigma_ol[:, j] = sol[N-L+1+(m+p)*L:N-L+1+(m+2*p)*L]
u_init_store[:, j-nu] = u_init.flatten()
y_init_store[:, j-nu] = y_init.flatten()
# Simulate closed loop
for k in range(j, min(j + M, T - 1)):
u_cl[:, k] = u_ol[m*n + (k - j) * m : m*n + m + (k - j) * m, j]
# Up... | Python | 1 |
ng the arguments
cliswitch = module.params['pn_cliswitch']
state = module.params['state']
netmask = module.params['pn_netmask']
ospf_area = module.params['pn_ospf_area']
network = module.params['pn_network']
vrouter_name = module.params['pn_vrouter_name']
command = state_map[state]
# B... | Python | 1 |
# Copyright (c) 2024 Microsoft Corporation.
# Licensed under the MIT License
"""Persona, entity type, relationships and domain generation prompts module."""
from .community_reporter_role import GENERATE_COMMUNITY_REPORTER_ROLE_PROMPT
from .domain import GENERATE_DOMAIN_PROMPT
from .entity_relationship import (
EN... | Python | 1 |
driver, time)
this_locator = self.get_locators(locator)
element = self._wait.until(ec.frame_to_be_available_and_switch_to_it(this_locator))
return element
def wait_invisibility(self, locator:dict, time=10):
'''
Espera o elemento não estar presente na tela, altura e larg... | Python | 1 |
, config::AdcConfig};
use rand_chacha::{
ChaCha8Rng,
rand_core::SeedableRng,
};
mod patterns;
#[entry]
fn main() -> ! {
rtt_init_print!();
if let (Some(dp), Some(cp)) = (
stm32::Peripherals::take(),
cortex_m::peripheral::Peripherals::take(),
) {
let rcc = dp.RCC.constrain... | Rust | 0 |
from typing import List
# time: O(n^2)
# space: O(1)
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
n = len(matrix)
# transpose (flip across diagonal)
for row in range(n):
for col in range(row + 1, n):
matrix[row][col], matrix[col][row] = ma... | Python | 1 |
info(
f"GRPC invoke {context.controller_method.name}({message_to_str(request)}) "
f"[OK] {context.elapsed_time} ms"
)
class StreamStreamMethod(UnaryStreamMethod):
"""Implementation of a stream-stream gRPC method (streaming request, streaming response)."""
mode = MethodMode.STR... | Python | 1 |
BLOCKING_VEHICLES = 37
TL_COMPLETE_DEFINITION_RYG = 43
TL_COMPLETE_PROGRAM_RYG = 44
TL_CONTROLLED_JUNCTIONS = 42
TL_CONTROLLED_LANES = 38
TL_CONTROLLED_LINKS = 39
TL_CURRENT_PHASE = 40
TL_CURRENT_PROGRAM = 41
TL_EXTERNAL_STA... | Python | 1 |
path.join(best_save_path, 'best_{}.pth'.format(0))))
sd = model.state_dict()
for i in range(1,args.n_average_model):
model.load_state_dict(torch.load(os.path.join(best_save_path, 'best_{}.pth'.format(i))))
print('Model loaded : {}'.format(os.path.join(best_save_path, 'best_{}.pth... | Python | 1 |
import os
import numpy as np
import torch
from torch.autograd import Function
try:
import raymarch_cuda
except Exception as e:
print('please build extensions/ngp_raymarch for NGPGridSampler')
class _update_bitfield(Function):
@staticmethod
def forward(ctx, density_grid, density_grid_mean, density_gr... | Python | 1 |
ge::Identity::new(
name.to_string(),
Inlet::new(name.clone(), PORT_DATA),
Outlet::new(name.clone(), PORT_DATA),
);
Self::with_transform(name, policy, identity).await
}
}
impl<T, C, D> PolicyPhase<T, T, C, D>
where
T: AppData + ToPolar,
C: ProctorContext,
... | Rust | 0 |
!("8otpHxrRhyCsYXx5JZyHscYD3eZu1ujzjFDXPctqYFHd");
// basic anchor definition
// #[program] is where the function for the logic of the program is written
// #[derive(Accounts)] is where is put our structs
// #[account]
#[program]
pub mod myepicproject {
use super::*;
pub fn start_stuff_off(ctx: Context<StartStuf... | Rust | 0 |
ppingPage:
"""
Retrieve a specific page of IpAccessControlListMappingInstance records from the API.
Request is executed immediately
:param target_url: API-generated URL for the requested results page
:returns: Page of IpAccessControlListMappingInstance
"""
respo... | Python | 1 |
(visible as u8)).expect("set isVisible value");
}
if digit.decimal.is_some() {
let decimal = digit.decimal.unwrap();
env.set_field(digit_class_obj, "decimal", "I", JValue::Int(decimal as i32)).expect("set decimal value");
}
if digit.imgurl.is_some() {
... | Rust | 0 |
import cv2
import numpy as np
from paddleocr import PaddleOCR
from moviepy.video.io.VideoFileClip import VideoFileClip
import difflib
# Khởi tạo OCR với ngôn ngữ Trung (ch)
ocr = PaddleOCR(lang='ch')
# Đường dẫn video
video_path = 'input.mp4'
clip = VideoFileClip(video_path)
# Thông số video
video_fps = clip.fps
# ... | Python | 1 |
template_system_general_summary = """
Eres un modelo avanzado de inteligencia artificial especializado en generar resúmenes claros, concisos y organizados de cualquier tipo de contenido. Tu objetivo es procesar la información proporcionada y generar un resumen estructurado que destaque los puntos clave.
1. **Instruc... | Python | 1 |
64,
/// Output only. The actual training cost of the model, expressed in milli
/// node hours, i.e. 1,000 value in this field means 1 node hour. Guaranteed
/// to not exceed the train budget.
#[prost(int64, tag="7")]
pub train_cost_milli_node_hours: i64,
/// Use the entire training budget. This ... | Rust | 0 |
print("Count to 10!")
for x in range (0, 11):
print(x) | Python | 1 |
intercepted_handler = self.interceptor.intercept_service(
continuation, handler_call_details
)
expected_logs = self.get_expected_logs(expected_method_name)
# Execute: Invoke the intercepted unary_unary method
dummy_request = MagicMock()
dummy_context = MagicMo... | Python | 1 |
lif action == "reschedule":
SHEET.update_cell(row, 5, "Reschedule Requested")
await query.message.reply_text("♻ Reschedule requested. User asked to select a new date/time.")
if user_id:
await context.bot.send_message(
chat_id=user_id,
... | Python | 1 |
from typing import Union
import torch
class Timesteps:
"""
Sampling timesteps.
It defines the discretization of sampling steps.
"""
def __init__(
self,
T: int,
steps: int,
device: torch.device = "cpu",
):
self.T = T
timesteps = torch.arange(T, -... | Python | 1 |
# main.py - A playground for experimenting with Python code
def hello_world():
"""Simple function to print 'Hello, World!'"""
print("Hello, World!")
def fibonacci(n):
"""Generate the first n numbers of the Fibonacci sequence"""
fib_sequence = [0, 1]
while len(fib_sequence) < n:
fib_sequenc... | Python | 1 |
#Decode the string
class Solution:
def decodedString(self, s: str) -> str:
# The stack will store tuples of (string_so_far, repetition_count)
# for each level of nesting.
stack = []
current_num = 0
current_str = ""
for char in s:
if char.isdigit():
... | Python | 1 |
it
loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(TestEPUBTranslator)
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
if result.wasSuccessful():
print("✅ All unit tests passed!")
else:
print("⚠️ Some u... | Python | 1 |
imizer variables
for var in optimizer.variables():
var.assign(tf.zeros_like(var))
loss_weights = None
weighted_metrics = None
if self.model.compiled_loss:
loss_weights = self.model.compiled_loss._loss_weights # pylint: disable=W0212
if self.model.compile... | Python | 1 |
}
/**
* [0433] Minimum Genetic Mutation
*
* A gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'.
* Suppose we need to investigate a mutation from a gene string start to a gene string end where one mutation is defined as one single character changed in the gene s... | Rust | 0 |
# -*- coding: utf-8 -*-
"""
Noise Frequency Spectrum Analysis v1.0
Lukas Kostal, 17.3.2024, ICL
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as ss
import scipy.optimize as so
import scipy.fft as sf
import scipy.integrate as si
def res(x, a0, a1, fsr):
y = a0 / (1 + a1 * (np.sin(np... | Python | 1 |