Struct caffe2op_percentile::PercentileOp
source · pub struct PercentileOp<Context> { /* private fields */ }
Expand description
| Operator to calculate percentile values | for an input tensor of data, given samples | of data from the same distribution, | labeled with their percentile values. | | This operator is used to find percentile | representations for raw values, given | a sample set of raw values, labeled with | their corresponding percentiles from | the same distribution. | | In particular, this operator takes | as input a tensor of floats to find the | percentile values for, a 2D tensor of | floats, where the first column of the | tensor represents sampled values, | and the second column represents the | percentile labels, and a tensor of integers | lengths. | | This lengths tensor is used because | the operator works on multiple sets | of raw values at the same time. For example, | for an input: | | original_values=[[3, 5, 3],[5, 1, 6]], | | lengths = [2, 1, 1], | | value_to_pct = [[3, 0.2], [5, 0.5], [1, 0.3], [3. 0.6]] | | Our operator expects that each column | i of the input tensor is sampled from | distribution i. Lengths tells us that | the first two elements in value_to_pct | are sampled from distribution 1, the | next is from distribution two, and the | last is from distribution 3. We expect | the output of our operator to give us | [[0.2, 1.0, 0.6], [0.5, 0.3, 1.0]]. | | To calculate the percentile of an element, | we check to see if its value is already | mapped to a percentile in value_to_pct. | If so, we return that value. If not, we | linearly interpolate between the two | closest values in value_to_pct. If | the value is larger than all values in | value_to_pct, we return 1. If it’s smaller | than all the values, we return 0. |
Implementations§
source§impl<Context> PercentileOp<Context>
impl<Context> PercentileOp<Context>
source§impl PercentileOp<CPUContext>
impl PercentileOp<CPUContext>
pub fn run_on_device(&mut self) -> bool
Auto Trait Implementations§
impl<Context> !RefUnwindSafe for PercentileOp<Context>
impl<Context> !Send for PercentileOp<Context>
impl<Context> !Sync for PercentileOp<Context>
impl<Context> Unpin for PercentileOp<Context>where Context: Unpin,
impl<Context> !UnwindSafe for PercentileOp<Context>
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.