6个版本 (3个稳定)
2.0.3 | 2024年6月18日 |
---|---|
2.0.2 | 2024年6月8日 |
0.1.2 | 2023年10月16日 |
#477 in 科学
每月358次下载
用于 raybnn_raytrace
22KB
333 行
RayBNN_Cell
使用CUDA、OpenCL和oneAPI通过GPU、CPU和FPGA为RayBNN生成细胞位置的库
安装Arrayfire
在 https://arrayfire.com/binaries/ 安装Arrayfire 3.9.0的二进制文件
或从源代码构建 https://github.com/arrayfire/arrayfire/wiki/Getting-ArrayFire
添加到Cargo.toml
arrayfire = { version = "3.8.1", package = "arrayfire_fork" }
rayon = "1.7.0"
num = "0.4.1"
num-traits = "0.2.16"
half = { version = "2.3.1" , features = ["num-traits"] }
RayBNN_DataLoader = "2.0.3"
RayBNN_Cell = "2.0.3"
示例列表
生成细胞并检查碰撞
//Generate Random Uniform Cells within a Sphere
let mut cell_pos: arrayfire::Array<f32> = RayBNN_Cell::Hidden::Sphere::generate_uniform_sphere_position(&modeldata_float, &modeldata_int);
//Get indicies of non colliding cells
let idx = RayBNN_Cell::Hidden::Sphere::check_cell_collision_minibatch(
&modeldata_float,
&cell_pos
);
let idx = arrayfire::locate(&idx);
//Select non colliding cells
cell_pos = arrayfire::lookup(&cell_pos, &idx, 0);
细胞碰撞检查器的类型
//Checks One by one
let idx = RayBNN_Cell::Hidden::Sphere::check_cell_collision_serial(
&modeldata_float,
&cell_pos
);
//Checks All cells at once
let idx = RayBNN_Cell::Hidden::Sphere::check_cell_collision_batch(
&modeldata_float,
&cell_pos
);
//Checks in minibatches
let idx = RayBNN_Cell::Hidden::Sphere::check_cell_collision_minibatch(
&modeldata_float,
&cell_pos
);
生成输入神经元位置
let input_neurons: arrayfire::Array<f64> = RayBNN_Cell::Input::Sphere::create_spaced_neurons_1D(
sphere_rad,
input_size,
);
依赖项
~7MB
~140K SLoC