Add missing declarations for explicit instantiations.

The current behaviour (using externally defined instantiations without having seen a declaration of those external instantiations) is undesirable and effectively deprecated, and is warned about by -Wundefined-func-template.

PiperOrigin-RevId: 252940775
This commit is contained in:
A. Unique TensorFlower 2019-06-12 18:20:29 -07:00 committed by TensorFlower Gardener
parent 30b29861dc
commit da251b3c48
2 changed files with 35 additions and 0 deletions

View File

@ -1335,6 +1335,17 @@ class OpKernelContext {
TF_DISALLOW_COPY_AND_ASSIGN(OpKernelContext);
};
template <>
const Eigen::ThreadPoolDevice& OpKernelContext::eigen_device() const;
template <>
const Eigen::GpuDevice& OpKernelContext::eigen_device() const;
#ifdef TENSORFLOW_USE_SYCL
template <>
const Eigen::SyclDevice& OpKernelContext::eigen_device() const;
#endif
// Register your OpKernel by specifying the Op's name, the device the
// kernel runs on, any type attr constraints for this kernel, any
// host-memory args, and the class to instantiate. Examples:

View File

@ -104,6 +104,30 @@ class Spectrogram {
std::vector<double> fft_double_working_area_;
};
// Explicit instantiations in spectrogram.cc.
extern template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<float>& input,
std::vector<std::vector<std::complex<float>>>*);
extern template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<double>& input,
std::vector<std::vector<std::complex<float>>>*);
extern template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<float>& input,
std::vector<std::vector<std::complex<double>>>*);
extern template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<double>& input,
std::vector<std::vector<std::complex<double>>>*);
extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<float>& input, std::vector<std::vector<float>>*);
extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<double>& input, std::vector<std::vector<float>>*);
extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<float>& input, std::vector<std::vector<double>>*);
extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<double>& input, std::vector<std::vector<double>>*);
} // namespace internal
} // namespace tflite