-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
address commments
Signed-off-by: Keming <[email protected]>
Showing
12 changed files
with
73 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use base::operator::*; | ||
use base::scalar::F32; | ||
use quantization::operator::OperatorQuantization; | ||
use storage::OperatorStorage; | ||
|
||
pub trait OperatorInverted: OperatorQuantization + OperatorStorage { | ||
fn to_index_vec(vec: Borrowed<'_, Self>) -> Vec<(u32, F32)>; | ||
} | ||
|
||
impl OperatorInverted for SVecf32Dot { | ||
fn to_index_vec(vec: Borrowed<'_, Self>) -> Vec<(u32, F32)> { | ||
std::iter::zip(vec.indexes().to_vec(), vec.values().to_vec()).collect() | ||
} | ||
} | ||
|
||
macro_rules! unimpl_operator_inverted { | ||
($t:ty) => { | ||
impl OperatorInverted for $t { | ||
fn to_index_vec(_: Borrowed<'_, Self>) -> Vec<(u32, F32)> { | ||
unimplemented!() | ||
} | ||
} | ||
}; | ||
} | ||
|
||
unimpl_operator_inverted!(SVecf32Cos); | ||
unimpl_operator_inverted!(SVecf32L2); | ||
unimpl_operator_inverted!(BVecf32Cos); | ||
unimpl_operator_inverted!(BVecf32Dot); | ||
unimpl_operator_inverted!(BVecf32Jaccard); | ||
unimpl_operator_inverted!(BVecf32L2); | ||
unimpl_operator_inverted!(Vecf32Cos); | ||
unimpl_operator_inverted!(Vecf32Dot); | ||
unimpl_operator_inverted!(Vecf32L2); | ||
unimpl_operator_inverted!(Vecf16Cos); | ||
unimpl_operator_inverted!(Vecf16Dot); | ||
unimpl_operator_inverted!(Vecf16L2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters