use super::dispatch::Plan;
use super::{EmbeddingBatch, Fp16Policy, ResNetEmbedding};
use crate::inference::cuda::{CudaError, CudaRuntime};
impl ResNetEmbedding {
pub(crate) fn batch_without_fp16(
&self,
runtime: &CudaRuntime,
chunks: usize,
) -> Result<EmbeddingBatch, CudaError> {
let activations = self.activations(runtime, chunks)?;
self.batch_with_policy(runtime, chunks, activations, Fp16Policy::Excluded)
}
}
impl EmbeddingBatch {
pub(crate) fn fp16_convs(&self) -> Vec<&str> {
self.plans
.iter()
.filter(|(_, plan)| matches!(plan, Plan::Wideconv(plan) if plan.is_fp16()))
.map(|(name, _)| name.as_str())
.collect()
}
pub(crate) fn recomputed_without_fp16(&self) -> bool {
self.fallback.is_some()
}
}