text stringlengths 1 2.05k |
|---|
"split_to_sequence_fp16x16_2d_variable_parts"
make_test(
[_x], _y, "input_0.split_to_sequence(1, 1, Option::Some(TensorTrait::<u32>::new(shape: array![2].span(), data: array![2, 4].span(),)))", name)
def split_to_sequence_zero_size():
x = to_fp(np.ar... |
y, "input_0.split_to_sequence(0, 1, Option::Some(TensorTrait::<u32>::new(shape: array![1].span(), data: array![4].span())))", name)
def split_to_sequence_2d_uneven():
x = to_fp(np.random.randint(-127, 127, (2, 8)
).astype(np.int64), FixedImpl.FP1... |
import numpy as np
from nodegen.node import RunAll
from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl
class Sqrt(RunAll):
@staticmethod
def sqrt_fp8x23():
x = np.random.uniform(0, 6, (2, 2)).astype(np.float64)
y = np.sqrt(x)
x = Tensor(Dtype.FP8x23, x.shape, to_fp(
... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Squeeze(RunAll):
@staticmethod
def squeeze_i8():
def squeeze():
x = np.ones((1, 2, 1, 2, 1), dtype=np.int8)
y = np.ones((2, 2, 1), dtype=np.int8)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.shape, y.flatten())
... |
ef squeeze():
x = to_fp(np.random.randint(0, 255, (1, 2, 1, 2, 1)
).astype(np.int64), FixedImpl.FP8x23)
y = to_fp(np.random.randint(0, 255, (2, 2, 1)
).astype(np.int64), FixedImpl.FP8x23)
x = Tensor(Dtyp... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Sub(RunAll):
@staticmethod
def sub_u32():
def default():
x = np.random.randint(3, 6, (3, 3, 3)).astype(np.uint32)
y = np.random.randint(0, 3, (3, 3, 3)).astype(np.uint32)
z = x - y
x = Tensor(Dtype.U32, x.shape, x.flatten())
y = Tensor(D... |
dom.randint(-3, 3, (3, 3, 3)).astype(np.int8)
y = np.random.randint(-3, 3, (3, 3, 3)).astype(np.int8)
z = x - y
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.shape, y.flatten())
z = Tensor(Dtype.I8, z.shape, z.flatten())
name ... |
make_test([x, y], z, "input_0 - input_1", name)
default()
broadcast()
@staticmethod
def sub_fp16x16():
def default():
x = np.random.randint(-3, 3, (3, 3, 3)).astype(np.float64)
y = np.random.randint(-3, 3, (3, 3, 3)).astype(np.float64)
z = x - y
... |
import numpy as np
from nodegen.node import RunAll
from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl
class Tanh(RunAll):
@staticmethod
def tanh_fp8x23():
x = np.random.uniform(-3, 3, (2, 2)).astype(np.float64)
y = np.tanh(x)
x = Tensor(Dtype.FP8x23, x.shape, to_fp(
... |
import numpy as np
from nodegen.node import RunAll
from ..helpers import make_test, to_fp, Tensor, Dtype, FixedImpl, Trait
class Thresholded_relu(RunAll):
@staticmethod
def thresholded_relu_fp8x23():
alpha = 1.0
x = np.random.uniform(-5, 7, (2, 2)).astype(np.float64)
y = np.clip(x, ... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Transpose(RunAll):
@staticmethod
def transpose_u32():
def transpose_2D():
x = np.random.randint(0, 255, (2, 2)).astype(np.uint32)
y = np.transpose(x, [1, 0])
x = Tensor(Dtype.U32, x.shape, x.flatten())
y = Tensor(Dtype.U32, y.shape, y.flatten())
... |
en())
name = "transpose_i8_2d"
make_test(
[x], y, "input_0.transpose(array![1, 0].span())", name)
def transpose_3D():
x = np.random.randint(-127, 127, (2, 2, 2)).astype(np.int8)
y = np.transpose(x, [1, 2, 0])
x = Tensor(Dtype.I8, x.s... |
make_test(
[x], y, "input_0.transpose(array![1, 0].span())", name)
def transpose_3D():
x = to_fp(np.random.randint(-127, 127, (2, 2, 2)
).astype(np.int64), FixedImpl.FP16x16)
y = np.transpose(x, [1, 2, 0])
x = Tensor(D... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Trilu(RunAll):
@staticmethod
def trilu_u32():
def tril():
x = np.random.randint(0, 255, (4, 5)).astype(np.uint32)
y = np.tril(x)
x = Tensor(Dtype.U32, x.shape, x.flatten())
y = Tensor(Dtype.U32, y.shape, y.flatten())
name = "tril_u32"
... |
nsor(Dtype.U32, x.shape, x.flatten())
y = Tensor(Dtype.U32, y.shape, y.flatten())
name = "tril_u32_pos"
make_test(
[x], y, "input_0.trilu(false, 2)", name)
def tril_square():
x = np.random.randint(0, 255, (2, 3, 3)).astype(np.uint32... |
t_0.trilu(true, -1)", name)
def triu_one_row():
x = np.random.randint(0, 255, (3, 1, 5)).astype(np.uint32)
y = np.triu(x)
x = Tensor(Dtype.U32, x.shape, x.flatten())
y = Tensor(Dtype.U32, y.shape, y.flatten())
name = "triu_u32_one_row"
... |
r(Dtype.U32, x.shape, x.flatten())
y = Tensor(Dtype.U32, y.shape, y.flatten())
name = "triu_u32_square_neg"
make_test(
[x], y, "input_0.trilu(true, -1)", name)
def triu_zero():
x = np.random.randint(0, 255, (3, 0, 5)).astype(np.uint... |
make_test(
[x], y, "input_0.trilu(false, 0)", name)
def tril_out_neg():
x = np.random.randint(-127, 127, (4, 5)).astype(np.int32)
y = np.tril(x, k=-7)
x = Tensor(Dtype.I32, x.shape, x.flatten())
y = Tensor(Dtype.I32, y.shape, y.flatten())
... |
(np.int32)
y = np.tril(x, k=6)
x = Tensor(Dtype.I32, x.shape, x.flatten())
y = Tensor(Dtype.I32, y.shape, y.flatten())
name = "tril_i32_zero"
make_test(
[x], y, "input_0.trilu(false, 6)", name)
def triu():
x... |
make_test(
[x], y, "input_0.trilu(true, 6)", name)
def triu_pos():
x = np.random.randint(-127, 127, (4, 5)).astype(np.int32)
y = np.triu(x, k=2)
x = Tensor(Dtype.I32, x.shape, x.flatten())
y = Tensor(Dtype.I32, y.shape, y.flatten())
... |
np.random.randint(-127, 127, (4, 5)).astype(np.int8)
y = np.tril(x)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.shape, y.flatten())
name = "tril_i8"
make_test(
[x], y, "input_0.trilu(false, 0)", name)
... |
name = "tril_i8_pos"
make_test(
[x], y, "input_0.trilu(false, 2)", name)
def tril_square():
x = np.random.randint(-127, 127, (2, 3, 3)).astype(np.int8)
y = np.tril(x, k=0)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = T... |
pe(np.int8)
y = np.triu(x)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.shape, y.flatten())
name = "triu_i8_one_row"
make_test(
[x], y, "input_0.trilu(true, 0)", name)
def triu_out_neg():
... |
eg"
make_test(
[x], y, "input_0.trilu(true, -1)", name)
def triu_zero():
x = np.random.randint(-127, 127, (3, 0, 5)).astype(np.int8)
y = np.triu(x, k=6)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.s... |
[x], y, "input_0.trilu(false, 0)", name)
def tril_out_neg():
x = to_fp(np.random.randint(-127, 127, (4, 5)).astype(np.int64), FixedImpl.FP8x23)
y = np.tril(x, k=-7)
x = Tensor(Dtype.FP8x23, x.shape, x.flatten())
y = Tensor(Dtype.FP8x23, y.shape, y.flatten())
... |
[x], y, "input_0.trilu(false, -1)", name)
def tril_zero():
x = to_fp(np.random.randint(-127, 127, (3, 0, 5)).astype(np.int64), FixedImpl.FP8x23)
y = np.tril(x, k=6)
x = Tensor(Dtype.FP8x23, x.shape, x.flatten())
y = Tensor(Dtype.FP8x23, y.shape, y.flatten())
... |
.trilu(true, -7)", name)
def triu_out_pos():
x = to_fp(np.random.randint(-127, 127, (4, 5)).astype(np.int64), FixedImpl.FP8x23)
y = np.triu(x, k=6)
x = Tensor(Dtype.FP8x23, x.shape, x.flatten())
y = Tensor(Dtype.FP8x23, y.shape, y.flatten())
name =... |
ut_0.trilu(true, 6)", name)
tril()
tril_neg()
tril_one_row()
tril_out_neg()
tril_out_pos()
tril_pos()
tril_square()
tril_square_neg()
tril_zero()
triu()
triu_neg()
triu_one_row()
triu_out_neg()
triu_out_pos(... |
[x], y, "input_0.trilu(false, -7)", name)
def tril_out_pos():
x = to_fp(np.random.randint(-127, 127, (4, 5)).astype(np.int64), FixedImpl.FP16x16)
y = np.tril(x, k=6)
x = Tensor(Dtype.FP16x16, x.shape, x.flatten())
y = Tensor(Dtype.FP16x16, y.shape, y.flatten())... |
make_test(
[x], y, "input_0.trilu(false, 6)", name)
def triu():
x = to_fp(np.random.randint(-127, 127, (4, 5)).astype(np.int64), FixedImpl.FP16x16)
y = np.triu(x)
x = Tensor(Dtype.FP16x16, x.shape, x.flatten())
y = Tensor(Dtype.FP16x16, y.shape,... |
test(
[x], y, "input_0.trilu(true, 6)", name)
def triu_pos():
x = to_fp(np.random.randint(-127, 127, (4, 5)).astype(np.int64), FixedImpl.FP16x16)
y = np.triu(x, k=2)
x = Tensor(Dtype.FP16x16, x.shape, x.flatten())
y = Tensor(Dtype.FP16x16, y.sha... |
are()
triu_square_neg()
triu_zero() |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl
from typing |
import Optional
def _unsort_outputs(
x: np.ndarray,
axis: Optional[int],
unique_values: np.ndarray,
indices: np.ndarray,
inverse_indices: np.ndarray,
counts: np.ndarray,
) -> (np.ndarray, np.ndarray, np.ndarray, np.ndarray):
"""Unsort the result of np.unique().
This is done because nu... |
class Unique(RunAll):
@staticmethod
def unique_u32():
def without_axis_sorted():
x = np.random.randint(0, 5, (3, 3, 3)).astype(np.uint32)
axis = None
unique_values, indices, inverse_indices, counts = np.unique(
x, axis=axis, return_index=True, return_... |
32_without_axis_not_sorted"
make_test(
[x],
(unique_values, indices, inverse_indices, counts),
"input_0.unique(Option::None(()), Option::Some(false))",
name,
)
def with_axis_zero_sorted():
x = np.random.randint(... |
Dtype.I32, inverse_indices.shape, inverse_indices.flatten()
)
counts = Tensor(Dtype.I32, counts.shape, counts.flatten())
name = "unique_u32_with_axis_zero_not_sorted"
make_test(
[x],
(unique_values, indices, inverse_indices, counts),
... |
ype.U32, unique_values.shape, unique_values.flatten()
)
indices = Tensor(Dtype.I32, indices.shape, indices.flatten())
inverse_indices = Tensor(
Dtype.I32, inverse_indices.shape, inverse_indices.flatten()
)
counts = Tensor(Dtype.I32, counts.shap... |
)
def with_axis_zero_sorted():
x = np.random.uniform(-3, 3, (3, 3, 3)).astype(np.float64)
axis = 0
unique_values, indices, inverse_indices, counts = np.unique(
x, axis=axis, return_index=True, return_inverse=True, return_counts=True
)
... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Unsqueeze(RunAll):
@staticmethod
def unsqueeze_u32():
def unsqueeze_2D():
x = np.random.randint(0, 255, (2, 4)).astype(np.uint32)
y = np.expand_dims(x, axis=0)
y = np.expand_dims(y, axis=1)
y = np.expand_dims(y, axis=4)
x = Tensor(Dtype.... |
pan())", name)
unsqueeze_2D()
unsqueeze_3D()
@staticmethod
def unsqueeze_i8():
def unsqueeze_2D():
x = np.random.randint(-127, 127, (2, 4)).astype(np.int8)
y = np.expand_dims(x, axis=0)
y = np.expand_dims(y, axis=1)
y = np.expand_dims(y,... |
, x.flatten())
y = Tensor(Dtype.FP8x23, y.shape, y.flatten())
name = "unsqueeze_fp8x23_3d"
make_test(
[x], y, "input_0.unsqueeze(array![5, 4, 2].span())", name)
unsqueeze_2D()
unsqueeze_3D()
@staticmethod
def unsqueeze_fp16x16():... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Where(RunAll):
@staticmethod
def where_u32():
def default():
cond = np.random.choice([1, 0], (3, 3, 3)).astype(np.uint32)
x = np.random.randint(0, 6, (3, 3, 3)).astype(np.uint32)
y = np.random.randint(0, 6, (3, 3, 3)).astype(np.uint32)
... |
.where(@input_1,@input_2)", name)
def broadcast():
cond = np.random.choice([1, 0], (1, 1)).astype(np.int32)
x = np.random.randint(0, 6, (2, 2)).astype(np.int32)
y = np.random.randint(0, 6, (1, 2)).astype(np.int32)
z = np.where(cond, x, y).astype(x.dtype)
... |
()
@staticmethod
def where_fp8x23():
def default():
cond = np.random.choice([1, 0], (3, 3, 3)).astype(np.float64)
x = np.random.randint(0, 6, (3, 3, 3)).astype(np.float64)
y = np.random.randint(0, 6, (3, 3, 3)).astype(np.float64)
z = np.where... |
z = np.where(cond, x, y).astype(x.dtype)
cond = Tensor(Dtype.FP16x16, cond.shape, to_fp(
cond.flatten(), FixedImpl.FP16x16))
x = Tensor(Dtype.FP16x16, x.shape, to_fp(
x.flatten(), FixedImpl.FP16x16))
y = Tensor(Dtype.FP16x16, y.shape, to_fp(
... |
import numpy as np
from nodegen.node |
import RunAll
from ..helpers |
import make_test, to_fp, Tensor, Dtype, FixedImpl |
class Xor(RunAll):
@staticmethod
def xor_u32():
def default():
x = np.random.randint(0, 6, (3, 3, 3)).astype(np.uint32)
y = np.random.randint(0, 6, (3, 3, 3)).astype(np.uint32)
z = np.logical_xor(x, y)
x = Tensor(Dtype.U32, x.shape, x.flatten())
... |
d
def xor_i8():
def default():
x = np.random.randint(-3, 3, (3, 3, 3)).astype(np.int8)
y = np.random.randint(-3, 3, (3, 3, 3)).astype(np.int8)
z = np.logical_xor(x, y)
x = Tensor(Dtype.I8, x.shape, x.flatten())
y = Tensor(Dtype.I8, y.shape, y.flat... |
name = "xor_fp8x23_broadcast"
make_test([x, y], z, "input_0.xor(@input_1)", name)
default()
broadcast()
@staticmethod
def xor_fp16x16():
def default():
x = np.random.randint(-3, 3, (2, 2)).astype(np.float64)
y = np.random.randint(-3, 3, (1, 2)).astyp... |
import os
import glob
import subprocess
# Directory path where Python files/modules are located
directory_path = 'nodegen/node/'
# Get all files in the directory
all_files = os.listdir(directory_path)
# Filter Python files using glob and '*.py' pattern
python_files = [file[:-3] for file in all_files if file.endswith... |
mod operators;
mod numbers;
mod utils;
mod test_helper;
|
mod fixed_point;
mod complex_number;
use orion::numbers::fixed_point::core::FixedTrait;
use orion::numbers::fixed_point::implementations::fp8x23::core::{ONE as ONE_fp8x23};
use orion::numbers::fixed_point::implementations::fp16x16::core::{ONE as ONE_fp16x16};
use orion::numbers::fixed_point::implementations::fp64x64::... |
d(lhs: T, rhs: T) -> T;
fn sub(lhs: T, rhs: T) -> T;
}
use orion::numbers::fixed_point::implementations::fp8x23::core::{
FP8x23Impl, FP8x23, FP8x23Add, FP8x23Sub
};
use orion::numbers::fixed_point::implementations::fp8x23::math::core as core_fp8x23;
use orion::numbers::fixed_point::implementations::fp8x23::mat... |
fn atanh(self: FP8x23) -> FP8x23 {
FP8x23Impl::atanh(self)
}
fn cosh(self: FP8x23) -> FP8x23 {
FP8x23Impl::cosh(self)
}
fn sinh(self: FP8x23) -> FP8x23 {
FP8x23Impl::sinh(self)
}
fn tanh(self: FP8x23) -> FP8x23 {
FP8x23Impl::tanh(self)
}
fn zero() -> F... |
)
}
fn is_inf(self: FP8x23) -> bool {
FP8x23Impl::is_inf(self)
}
fn is_pos_inf(self: FP8x23) -> bool {
FP8x23Impl::is_pos_inf(self)
}
fn is_neg_inf(self: FP8x23) -> bool {
FP8x23Impl::is_neg_inf(self)
}
fn bitwise_and(lhs: FP8x23, rhs: FP8x23) -> FP8x23 {
... |
n round(self: FP8x23W) -> FP8x23W {
FP8x23WImpl::round(self)
}
fn sqrt(self: FP8x23W) -> FP8x23W {
FP8x23WImpl::sqrt(self)
}
fn acos(self: FP8x23W) -> FP8x23W {
FP8x23WImpl::acos(self)
}
fn asin(self: FP8x23W) -> FP8x23W {
FP8x23WImpl::asin(self)
}
fn ... |
fn max(self: FP8x23W, other: FP8x23W) -> FP8x23W {
comp_fp8x23wide::max(self, other)
}
fn mag(self: FP8x23W) -> u64 {
self.mag
}
fn is_neg(self: FP8x23W) -> bool {
self.sign
}
fn xor(lhs: FP8x23W, rhs: FP8x23W) -> bool {
comp_fp8x23wide::xor(lhs, rhs)
}
... |
ag: u32, sign: bool) -> FP16x16 {
FP16x16Impl::new(mag, sign)
}
fn new_unscaled(mag: u32, sign: bool) -> FP16x16 {
FP16x16Impl::new_unscaled(mag, sign)
}
fn from_felt(val: felt252) -> FP16x16 {
FP16x16Impl::from_felt(val)
}
fn ceil(self: FP16x16) -> FP16x16 {
F... |
FP16x16Impl::ZERO()
}
fn is_zero(self: FP16x16) -> bool {
core_fp16x16::eq(@self, @FP16x16Impl::ZERO())
}
fn half() -> FP16x16 {
FP16x16Impl::HALF()
}
fn one() -> FP16x16 {
FP16x16Impl::ONE()
}
fn neg_one() -> FP16x16 {
FP16x16 { mag: core_fp16x16::ONE,... |
bitwise_and(lhs: FP16x16, rhs: FP16x16) -> FP16x16 {
comp_fp16x16::bitwise_and(lhs, rhs)
}
fn bitwise_xor(lhs: FP16x16, rhs: FP16x16) -> FP16x16 {
comp_fp16x16::bitwise_xor(lhs, rhs)
}
fn bitwise_or(lhs: FP16x16, rhs: FP16x16) -> FP16x16 {
comp_fp16x16::bitwise_or(lhs, rhs)
... |
FP16x16WImpl::acos(self)
}
fn asin(self: FP16x16W) -> FP16x16W {
FP16x16WImpl::asin(self)
}
fn atan(self: FP16x16W) -> FP16x16W {
FP16x16WImpl::atan(self)
}
fn cos(self: FP16x16W) -> FP16x16W {
FP16x16WImpl::cos(self)
}
fn sin(self: FP16x16W) -> FP16x16W {
... |
6W) -> u64 {
self.mag
}
fn is_neg(self: FP16x16W) -> bool {
self.sign
}
fn xor(lhs: FP16x16W, rhs: FP16x16W) -> bool {
comp_fp16x16wide::xor(lhs, rhs)
}
fn or(lhs: FP16x16W, rhs: FP16x16W) -> bool {
comp_fp16x16wide::or(lhs, rhs)
}
fn sign(self: FP16x1... |
ew(mag, sign)
}
fn new_unscaled(mag: u128, sign: bool) -> FP64x64 {
FP64x64Impl::new_unscaled(mag, sign)
}
fn from_felt(val: felt252) -> FP64x64 {
FP64x64Impl::from_felt(val)
}
fn ceil(self: FP64x64) -> FP64x64 {
FP64x64Impl::ceil(self)
}
fn exp(self: FP64x64)... |
FP64x64) -> bool {
fp64x64::ops::eq(@self, @FP64x64Impl::ZERO())
}
fn half() -> FP64x64 {
FP64x64Impl::HALF()
}
fn one() -> FP64x64 {
FP64x64Impl::ONE()
}
fn neg_one() -> FP64x64 {
FP64x64 { mag: core_fp64x64::ONE, sign: true }
}
fn is_one(self: FP64x6... |
comp_fp64x64::bitwise_and(lhs, rhs)
}
fn bitwise_xor(lhs: FP64x64, rhs: FP64x64) -> FP64x64 {
comp_fp64x64::bitwise_xor(lhs, rhs)
}
fn bitwise_or(lhs: FP64x64, rhs: FP64x64) -> FP64x64 {
comp_fp64x64::bitwise_or(lhs, rhs)
}
fn add(lhs: FP64x64, rhs: FP64x64) -> FP64x64 {
... |
(self)
}
fn atan(self: FP32x32) -> FP32x32 {
FP32x32Impl::atan(self)
}
fn cos(self: FP32x32) -> FP32x32 {
FP32x32Impl::cos(self)
}
fn sin(self: FP32x32) -> FP32x32 {
FP32x32Impl::sin(self)
}
fn tan(self: FP32x32) -> FP32x32 {
FP32x32Impl::tan(self)
... |
n or(lhs: FP32x32, rhs: FP32x32) -> bool {
comp_fp32x32::or(lhs, rhs)
}
fn sign(self: FP32x32) -> FP32x32 {
FP32x32Impl::sign(self)
}
fn and(lhs: FP32x32, rhs: FP32x32) -> bool {
comp_fp32x32::and(lhs, rhs)
}
fn where(self: FP32x32, x: FP32x32, y: FP32x32) -> FP32x32 {... |
: i8) -> i8 {
panic(array!['not supported!'])
}
fn log10(self: i8) -> i8 {
panic(array!['not supported!'])
}
fn pow(self: i8, b: i8) -> i8 {
panic(array!['not supported!'])
}
fn round(self: i8) -> i8 {
panic(array!['not supported!'])
}
fn sqrt(self: i8... |
i8) -> i8 {
if self > other {
self
} else {
other
}
}
fn mag(self: i8) -> i8 {
self
}
fn is_neg(self: i8) -> bool {
self < 0
}
fn xor(lhs: i8, rhs: i8) -> bool {
if (lhs == 0 || rhs == 0) && lhs != rhs {
true
... |
s_positive = rhs * -1;
}
let lhs_felt: felt252 = lhs_positive.into();
let rhs_felt: felt252 = rhs_positive.into();
let lhs_u128: u128 = lhs_felt.try_into().unwrap();
let rhs_u128: u128 = rhs_felt.try_into().unwrap();
let mut result = lhs_u128 / rhs_u128;
... |
fn div_eq(ref self: i8, other: i8) {
self = Div::div(self, other);
}
}
impl I8IntoFP8x23 of Into<i8, FP8x23> {
fn into(self: i8) -> FP8x23 {
let number_sign: bool = self < 0;
let mut self_positive: i8 = self;
if number_sign {
self_positive = self_positive * -1_i8
... |
(mag: i16, sign: bool) -> i16 {
mag
}
fn from_felt(val: felt252) -> i16 {
panic(array!['not supported!'])
}
fn ceil(self: i16) -> i16 {
panic(array!['not supported!'])
}
fn exp(self: i16) -> i16 {
panic(array!['not supported!'])
}
fn exp2(self: i16) ->... |
}
fn one() -> i16 {
1
}
fn neg_one() -> i16 {
-1
}
fn is_one(self: i16) -> bool {
self == 1
}
fn abs(self: i16) -> i16 {
if self >= 0 {
self
} else {
self * -1_i16
}
}
fn neg(self: i16) -> i16 {
self... |
anic(array!['not supported!'])
}
fn bitwise_xor(lhs: i16, rhs: i16) -> i16 {
panic(array!['not supported!'])
}
fn bitwise_or(lhs: i16, rhs: i16) -> i16 {
panic(array!['not supported!'])
}
fn add(lhs: i16, rhs: i16) -> i16 {
lhs + rhs
}
fn sub(lhs: i16, rhs: i1... |
fn div_eq(ref self: i16, other: i16) {
self = Div::div(self, other);
}
}
impl I32Number of NumberTrait<i32, i32> {
fn new(mag: i32, sign: bool) -> i32 {
if sign {
return -mag;
}
mag
}
fn new_unscaled(mag: i32, sign: bool) -> i32 {
mag
}
fn ... |
ported!'])
}
fn tanh(self: i32) -> i32 {
panic(array!['not supported!'])
}
fn zero() -> i32 {
0
}
fn is_zero(self: i32) -> bool {
self == 0
}
fn half() -> i32 {
panic(array!['not supported!'])
}
fn one() -> i32 {
1
}
fn neg_one... |
fn is_inf(self: i32) -> bool {
self == 2147483647 || self == -2147483647
}
fn is_pos_inf(self: i32) -> bool {
self == 2147483647
}
fn is_neg_inf(self: i32) -> bool {
self == -2147483647
}
fn bitwise_and(lhs: i32, rhs: i32) -> i32 {
panic(array!['not supported!'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.