feat: dot weights are signed

This commit is contained in:
rudy
2022-09-13 16:07:05 +02:00
committed by rudy-6-4
parent 3b9535ac2f
commit 1f15162b39
9 changed files with 46 additions and 27 deletions

View File

@@ -247,7 +247,7 @@ impl OperationDag {
pub struct Weights(operator::Weights);
fn vector(weights: &[u64]) -> Box<Weights> {
fn vector(weights: &[i64]) -> Box<Weights> {
Box::new(Weights(operator::Weights::vector(weights)))
}
@@ -320,7 +320,7 @@ mod ffi {
type Weights;
#[namespace = "concrete_optimizer::weights"]
fn vector(weights: &[u64]) -> Box<Weights>;
fn vector(weights: &[i64]) -> Box<Weights>;
}
#[derive(Clone, Copy)]

View File

@@ -1099,7 +1099,7 @@ void concrete_optimizer$cxxbridge1$OperationDag$dump(const ::concrete_optimizer:
namespace weights {
extern "C" {
::concrete_optimizer::Weights *concrete_optimizer$weights$cxxbridge1$vector(::rust::Slice<const ::std::uint64_t> weights) noexcept;
::concrete_optimizer::Weights *concrete_optimizer$weights$cxxbridge1$vector(::rust::Slice<const ::std::int64_t> weights) noexcept;
} // extern "C"
} // namespace weights
@@ -1172,7 +1172,7 @@ namespace dag {
}
namespace weights {
::rust::Box<::concrete_optimizer::Weights> vector(::rust::Slice<const ::std::uint64_t> weights) noexcept {
::rust::Box<::concrete_optimizer::Weights> vector(::rust::Slice<const ::std::int64_t> weights) noexcept {
return ::rust::Box<::concrete_optimizer::Weights>::from_raw(concrete_optimizer$weights$cxxbridge1$vector(weights));
}
} // namespace weights

View File

@@ -1050,6 +1050,6 @@ namespace dag {
} // namespace dag
namespace weights {
::rust::Box<::concrete_optimizer::Weights> vector(::rust::Slice<const ::std::uint64_t> weights) noexcept;
::rust::Box<::concrete_optimizer::Weights> vector(::rust::Slice<const ::std::int64_t> weights) noexcept;
} // namespace weights
} // namespace concrete_optimizer

View File

@@ -42,7 +42,7 @@ void test_dag_no_lut() {
std::vector<concrete_optimizer::dag::OperatorIndex> inputs = {node1};
std::vector<uint64_t> weight_vec = {1, 1, 1};
std::vector<int64_t> weight_vec = {1, 1, 1};
rust::cxxbridge1::Box<concrete_optimizer::Weights> weights =
concrete_optimizer::weights::vector(slice(weight_vec));