Computes the spans for the passed kernel, for a input dimension of length input_size transformed by scale and translate to an output dimension of length output_size. Note that there's no requirement that; output_size = input_size * scale.
| 186 | // length output_size. Note that there's no requirement that; |
| 187 | // output_size = input_size * scale. |
| 188 | Status ComputeSpans(OpKernelContext* context, |
| 189 | const functor::SamplingKernelType kernel_type, |
| 190 | const int64 output_size, const int64 input_size, |
| 191 | const float scale, const float translate, |
| 192 | const bool antialias, Spans* spans) { |
| 193 | switch (kernel_type) { |
| 194 | case functor::Lanczos1Kernel: { |
| 195 | return ComputeSpansCore(context, CreateLanczos1Kernel(), output_size, |
| 196 | input_size, scale, translate, antialias, spans); |
| 197 | } |
| 198 | case functor::Lanczos3Kernel: { |
| 199 | return ComputeSpansCore(context, CreateLanczos3Kernel(), output_size, |
| 200 | input_size, scale, translate, antialias, spans); |
| 201 | } |
| 202 | case functor::Lanczos5Kernel: { |
| 203 | return ComputeSpansCore(context, CreateLanczos5Kernel(), output_size, |
| 204 | input_size, scale, translate, antialias, spans); |
| 205 | } |
| 206 | case functor::GaussianKernel: { |
| 207 | return ComputeSpansCore(context, CreateGaussianKernel(), output_size, |
| 208 | input_size, scale, translate, antialias, spans); |
| 209 | } |
| 210 | case functor::BoxKernel: { |
| 211 | return ComputeSpansCore(context, CreateBoxKernel(), output_size, |
| 212 | input_size, scale, translate, antialias, spans); |
| 213 | } |
| 214 | case functor::TriangleKernel: { |
| 215 | return ComputeSpansCore(context, CreateTriangleKernel(), output_size, |
| 216 | input_size, scale, translate, antialias, spans); |
| 217 | } |
| 218 | case functor::KeysCubicKernel: { |
| 219 | return ComputeSpansCore(context, CreateKeysCubicKernel(), output_size, |
| 220 | input_size, scale, translate, antialias, spans); |
| 221 | } |
| 222 | case functor::MitchellCubicKernel: { |
| 223 | return ComputeSpansCore(context, CreateMitchellCubicKernel(), output_size, |
| 224 | input_size, scale, translate, antialias, spans); |
| 225 | } |
| 226 | default: |
| 227 | return errors::InvalidArgument(Printf("Unrecognized kernel type: %d", |
| 228 | static_cast<int>(kernel_type))); |
| 229 | } |
| 230 | return Status::OK(); |
| 231 | } |
| 232 | |
| 233 | // Computes the grad spans for the passed kernel. |
| 234 | // forward_input_size and forward_output_size are the input and output size from |
no test coverage detected