text string | label_name string | labels int64 |
|---|---|---|
= torch.from_numpy(label.astype(np.float32))
low_res_label = torch.from_numpy(low_res_label.astype(np.float32))
image = image.permute(2, 0, 1)
label = label.permute(2, 0, 1)
low_res_label = low_res_label.permute(2, 0, 1)
bbox = torch.from_numpy(np.array(bbox).astype(np.float32))... | Python | 1 |
'back_box_min':back_box_min1,
'back_box_max':back_box_max1,
'front_box_cls_pred':front_box_cls_pred1,
'back_box_cls_pred':back_box_cls_pred1,
'x': x,
'y_gt': y_gt,
'z_gt': z_gt,
'front_translation':fro... | Python | 1 |
::raw::c_int,
) -> isize;
/// Specify with which local address and port the SCTP endpoint should
/// associate itself.
///
/// * `so`: Pointer to the socket as returned by [`usrsctp_socket()`].
/// * `addr`: The address structure ([`sockaddr_in`] for an IPv4 address
/// or [`sockaddr_in6`... | Rust | 0 |
> = BBBuffer::new();
static mut URC_QUEUE: BBBuffer<URC_CAPACITY_BYTES> = BBBuffer::new();
static mut COM_QUEUE: ComQueue = Queue::new();
// Setup clocks & peripherals
let mut flash = ctx.device.FLASH.constrain();
let mut rcc = ctx.device.RCC.constrain();
let mut pwr = c... | Rust | 0 |
de(default, with = "url_serde")]
#[serde(skip_serializing_if = "Option::is_none")]
pub api: Option<Url>,
#[doc(hidden)]
#[serde(skip)]
__nonexhaustive: (),
}
/// Return the configuration file in an index.
pub fn load_config(index: impl AsRef<Path>) -> Result<IndexConfig, Error> {
let path = ind... | Rust | 0 |
(self.as_array_mut(), pnidx);
}
pub fn load_as_nrm_mtx(&mut self, pnidx: u32) {
Gx::load_nrm_mtx_imm(self.as_array_mut(), pnidx);
}
pub fn load_as_tex_mtx(&mut self, pnidx: u32) {
Gx::load_tex_mtx_imm(self.as_array_mut(), pnidx);
}
}
//! High-level intermediate representation
//!
//!... | Rust | 0 |
_path() -> Option<OsString> {
var_os("PATH")
}
/// Get the value for the `$PATH` environment variable, split across a vector.
pub fn read_path() -> Vec<PathBuf> {
match read_raw_path() {
Some(path_str) => split_path_like(&path_str),
None => vec![PathBuf::from("")],
}
}
/// Split an `OsStri... | Rust | 0 |
x(form, textvariable=tipo_var, values=["Entrada", "Saida"], width=18, bootstyle="secondary").grid(row=0, column=1, padx=10, pady=5)
ttk.Label(form, text="Categoria:", font=default_font).grid(row=0, column=2, sticky=W, padx=5, pady=5)
ttk.Entry(form, textvariable=categoria_var, width=25).grid(row=0, column=3, padx=10, ... | Python | 1 |
precision_synchronous;
pub mod decentralized_low_precision_synchronous;
pub mod python_ffi_op;
use crate::datatypes::BaguaBucket;
use crate::{BaguaCommOpChannels, BaguaCoreError};
use std::fmt::Debug;
use std::sync::Arc;
pub trait CommOpTrait: Debug {
fn execute_background_communication(
&self,
bu... | Rust | 0 |
import numpy as np
import scipy
import pandas as pd
from VerificadorTabelacar import VerificadorTabelacar
def otimiza_regua(regua_ideal:pd.DataFrame, livres:pd.DataFrame)->tuple[pd.DataFrame,float]:
"""
Dado uma DF régua ideal de alocação de um ativo em vários fundos e um DF diferenças que dita qual a diferença... | Python | 1 |
===================
// =====================================================================================
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd)]
pub enum BoundaryCond{ // Boundary condition
Periodic, // Only valid for Rectanuglar system or La... | Rust | 0 |
--------------------------
#[derive(Debug, StructOpt)]
#[structopt(raw(
long_version = "option_env!(\"LONG_VERSION\").unwrap_or(env!(\"CARGO_PKG_VERSION\"))"
))]
#[structopt(raw(setting = "clap::AppSettings::ColoredHelp"))]
#[structopt(raw(setting = "clap::AppSettings::DeriveDisplayOrder"))]
pub struct Opt {
/... | Rust | 0 |
32,
}
#[derive(Debug)]
pub enum Error {
IO(std::io::Error),
Parsing(crate::protocol::parser::ParsingError),
}
extern crate nalgebra as na;
extern crate ncollide3d;
extern crate nphysics3d;
extern crate nphysics_testbed3d;
use na::{Point3, Vector3};
use ncollide3d::query::Proximity;
use ncollide3d::shape::{Bal... | Rust | 0 |
ear(1 + 8 * 2 * 1, 64).to(device)
self.layer2 = torch.nn.Linear(64, 30).to(device)
self.layer3 = torch.nn.Linear((3 + 10 * 2 * 3) + 30, 64).to(device)
self.layer4 = torch.nn.Linear(64, 64).to(device)
self.layer5 = torch.nn.Linear(64, 3).to(device)
# density估计网络
self.dens... | Python | 1 |
from dataclasses import dataclass
from typing import Any
from uuid import UUID
from src.domain.course.entities import Lesson
from src.domain.course.protocols import LessonRepo
from src.domain.exceptions import DomainError
from src.infra.protocols import S3Storage
@dataclass
class BaseCommand:
lesson_repo: Lesson... | Python | 1 |
idx is None:
bidx = i
if p == 0 and bidx is not None:
idxs.append((bidx, i))
bidx = None
if i == len(pred) - 1 and bidx is not None:
idxs.append((bidx, i+1))
# convert each bidx, eidx to a np array of the size of pred
# with 1 for each span
pre... | Python | 1 |
.any(|w| {
w[0] == triplet[0] && w[0] == w[1] && w[1] == w[2] && w[2] == w[3] &&
w[3] == w[4]
})
}) {
key_i += 1;
if key_i == 64 {
retu... | Rust | 0 |
import dataclasses
from typing import List
import numpy as np
from akuire.events import ManagerEvent
from akuire.events.data_event import DataEvent, ImageDataEvent
@dataclasses.dataclass
class PairedEvent:
manager: str
event: ManagerEvent
@dataclasses.dataclass
class Acquisition:
"""Class that represe... | Python | 1 |
ait
}
_ => Err(anyhow::Error::msg("unexpected subcommand")),
},
None => Err(anyhow::Error::msg("no subcommand found")),
}
}
async fn job_output(
secret_key: &str,
key_id: &str,
region: &str,
vault_name: &str,
job_id: &str,
) -> Result<()> {
let http_m... | Rust | 0 |
__author__ = 'ssj'
import json
import urllib
import logging
import sys
import time
# ---------------------------------
# Generate URL
# ---------------------------------
# This function converts the servername to URL which we need to query.
def get_url(server_name, listen_port):
"""
Generating URL to get ... | Python | 1 |
_median_conversion_time
FROM
(SELECT
aggregation_target,
steps,
avg(step_1_conversion_time) AS step_1_average_conversion_time_inner,
median(step_1_conversion_time) AS step_1_median_conversion_time_inner
FROM
(SELECT
aggregation_target,
steps,
... | Python | 1 |
ution._validate_metadataQ r 8 DMM*
*t}}c40
*
%:7)DC%c**
AAc U R R 5 H= u p#[ U R 5 R X!R X#" 5 5 5 M?... | Python | 1 |
, causing all execution to stop.
page_allocator::convert_to_heap_allocated();
frame_allocator::convert_to_heap_allocated();
let mut higher_half_mapped_pages: Vec<MappedPages> = higher_half_mapped_pages.iter_mut().filter_map(|opt| opt.take()).collect();
higher_half_mapped_pages.push(heap_mapped_pages... | Rust | 0 |
id: {:#066x}", tx_id);
let start = Instant::now();
while Instant::now() - start < TOTAL_TIMEOUT {
match (
start_coin.clone(),
check_cosmos_balance(dest, &contact).await,
) {
(Some(start_coin), Some(end_coin)) => {
if start_coin.amount + amount... | Rust | 0 |
_ticket_type> for $ticket_type {
type Error = Error;
fn try_from(tss_ticket: $tss_ticket_type) -> Result<Self> {
let tag = match StructureTag::try_from(tss_ticket.tag) {
Ok(val) => {
if !<$ticket_type>::POSSIBLE_TAGS.contains(&val) {
... | Rust | 0 |
timer if it was running.
pub fn cancel(&mut self) {
if let Some(abort_handle) = &mut self.abort_handle {
abort_handle.abort();
}
}
}
impl<E> Publisher for Timer<E>
where
E: Message,
{
type Message = E;
fn sender(&self) -> &Sender<E> {
match &self.sender {
... | Rust | 0 |
plexinterval_constraints(
lin_exp, eq_bound))
ref_bounds = lin_coeffs @ inp_bound.lower + shifted_prob_sol
_check_bounds(inp_bound, lin_coeffs, ref_bounds)
def test_project_onto_bound(self):
shape = (1, 10)
lower, upper = test_utils.sample_bounds(jax.random.PRNGKey(0),
... | Python | 1 |
def calculate_total( oranges, apples):
return 2*oranges + 3*apples
def plastic_bags_price(bags):
"""one bag 0.1, two bags 0.4, three bags 0.9 """
return 0.1*bags*bags | Python | 1 |
from skfp.fingerprints import ECFPFingerprint
>>> smiles = ["O", "CC", "[C-]#N", "CC=O"]
>>> fp = ECFPFingerprint()
>>> fp
ECFPFingerprint()
>>> fp.transform(smiles)
array([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ...,... | Python | 1 |
def is_on(self) -> bool:
"""Return true if low battery is detected from the binary sensor."""
return self.service.value(CharacteristicsTypes.STATUS_LO_BATT) == 1
ENTITY_TYPES = {
ServicesTypes.MOTION_SENSOR: HomeKitMotionSensor,
ServicesTypes.CONTACT_SENSOR: HomeKitContactSensor,
Serv... | Python | 1 |
,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
... | Rust | 0 |
::c_int + 2 as libc::c_int + 3 as libc::c_int)
as libc::c_int
& crate::jdct_h::RANGE_MASK) as isize,
);
*outptr.offset(7 as libc::c_int as isize) = *range_limit.offset(
((tmp27 + tmp13 >> 13 as libc::c_int + 2 as libc::c_int + 3 as libc::c_int)
... | Rust | 0 |
event["log"]["hello"] = "goodbye"
emit(event)
end
"""
"#,
)
.unwrap();
let n: usize = 10;
let events = (0..n).map(|i| Event::from(format!("program me {}", i)));
let in_stream = Box::pin(stream::iter(events));
let ou... | Rust | 0 |
es(),
&(headers.len() as u64).to_be_bytes(),
&headers,
].concat();
let sig = signer.sign(&message).await;
Signature {
cert_url,
cert_sha256,
date,
expires,
id,
sig,
validity_url,
}... | Rust | 0 |
);
}
pub fn set_play_pos(&self, pos: f64) {
#[cfg(not(feature="mpris"))]
let _ = pos;
#[cfg(feature="mpris")]
self.mpris.set_play_pos(pos);
}
pub fn set_is_shuffled(&self, is_shuffled: bool) {
#[cfg(not(feature="mpris"))]
let _ = is_shuffled;
#[cfg... | Rust | 0 |
f64, f64);
pub type TripleF64 = (f64, f64, f64);
pub type Sector = (u64, u64, u64, u64);
pub type Thread = JoinHandle<()>;
pub const DEFAULT_WIDTH : u64 = 640;
pub const DEFAULT_HEIGHT : u64 = 480;
pub const DEFAULT_FOV : f64 = 90.;
pub const DEFAULT_APERTURE : f64 = 1.;
pub const DEFAULT_ASPECT... | Rust | 0 |
earch_img":
cache = os.path.join(save_path, dataset_name, f"image_search_res_{idx}.json")
if os.path.exists(cache):
with open(cache) as f:
saved = json.load(f)
imgs, txts = parse_image_search_result_by_image(saved, save_path, idx, conversation_num)
if ... | Python | 1 |
layout: String },
}
lazy_static!{
static ref ORACLE_RE: Regex = Regex::new(r"(?P<reminder>\(.+\))").unwrap();
static ref MANACOST_RE: Regex = Regex::new(r"(?P<symbol>\{.+?\})").unwrap();
}
fn prettify_oracle_text(text: &str) -> String {
ORACLE_RE.replace_all(text, "<i>$reminder</i>")
.lines()
... | Rust | 0 |
class FilteredOutput:
"""
A class returned by the filter objects containing the sanitized or blocked prompt and an evaluation flag.
Attributes:
output (str): The sanitized or original prompt.
eval (Literal["SAFE", "UNSAFE", "BLOCKED"]): The evaluation flag.
"""
def __init__(self, o... | Python | 1 |
app,
commands: HashMap::new(),
default_action: Box::new(default_action),
state_initializer: Box::new(state_initializer),
console_support: None,
}
}
pub fn with_console_support_default(self) -> Self {
self.with_console_support(
... | Rust | 0 |
ce=mask_ms["stage1"].device, requires_grad=False)
if inverse:
depth_itv = (1/hypo_depth[:,2,:,:]-1/hypo_depth[:,1,:,:]).abs() # B H W
mask_out_of_range = ((1/hypo_depth - 1/depth_gt.unsqueeze(1)).abs() <= depth_itv.unsqueeze(1)).sum(1) == 0 # B H W
else:
depth_itv =... | Python | 1 |
{
contents.splice(.., new_contents.into_iter());
}
else {
self.0.push((new_filename, new_contents));
}
}
pub fn clear(&mut self) {
self.0.clear();
}
pub fn checksums(&self) -> Checksums {
self.0.iter()
.map(|(filename, data)|... | Rust | 0 |
: FormatType = "podcast",
system_prompt: str = None
) -> str:
try:
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)
try:
metadata = get_pdf_metadata(pdf_path)
if metadata:
logger.info(f"PDF Pages: {metadata['num_pages']}... | Python | 1 |
{constants, Buffer, BUFSIZ, FILE};
use core::{cell::UnsafeCell, ptr};
use crate::{fs::File, io::LineWriter, platform::types::*, sync::Mutex};
use alloc::vec::Vec;
pub struct GlobalFile(UnsafeCell<FILE>);
impl GlobalFile {
fn new(file: c_int, flags: c_int) -> Self {
let file = File::new(file);
let ... | Rust | 0 |
:launched=20230124
]}
:current=1
:time=20221221
:expires=2023
:price=1000000
:currency=usd
]
''')
self.len(1, nodes)
self.nn(... | Python | 1 |
ygame.K_r:
tetris.reset_game()
elif event.key == pygame.K_LEFT and not tetris.check_collision(dx=-1):
tetris.current_tetromino.x -= 1
elif event.key == pygame.K_RIGHT and not tetris.check_collision(dx=1):
tetris.current_tetromin... | Python | 1 |
# -*- coding: utf-8 -*-
'''Hierarchical Model for inferring the mean (mu)
and sample size (kappa) of various Bernoulli trials via MCMC.
Python (PyMC) adaptation of the R code from "Doing Bayesian Data Analysis",
by John K. Krushcke.
More info: http://doingbayesiandataanalysis.blogspot.com.br/
'''
from __future__ impor... | Python | 1 |
from builder import rule
import os, shutil, glob
# for a complete distribution build from scratch, say 'build clean all'
@rule()
def html():
"Create html files"
os.system("make html")
@rule("../winhelp")
def winhelp():
"Create Windows Help file"
dest = os.path.join(os.getcwd(), "..", "winhelp")
os... | Python | 1 |
default=None,
title="Random vertical flip",
description="Randomly flip images vertically along the horizontal axis (swap top and bottom)",
)
color_jitter: ColorJitter | None = Field(
default=None,
title="Color jitter",
description="Settings for random color jitter (bright... | Python | 1 |
5 5 $ )Nr r r r
ScalarListr )r r r s r: _foreach_lerp_scalarlistr J !!$$"";>
r< |