16 const std::vector<std::vector<float>>&)
const override;
19 std::unique_ptr<tf::Graph>
g;
29 pset.
get<std::vector<std::string>>(
"NNetOutputPattern", {
"cnn_output",
"dense_3"});
34 mf::LogInfo(
"WaveformRecogTf") <<
"TF model loaded.";
37 mf::LogError(
"WaveformRecogTf") <<
"File name extension not supported.";
44 std::vector<std::vector<float>>
47 if (waveforms.empty() || waveforms.front().empty()) {
48 return std::vector<std::vector<float>>();
51 long long int samples = waveforms.size(), numtcks = waveforms.front().size();
53 tensorflow::Tensor _x(tensorflow::DT_FLOAT, tensorflow::TensorShape({samples, numtcks, 1}));
54 auto input_map = _x.tensor<
float, 3>();
55 for (
long long int s = 0;
s < samples; ++
s) {
56 const auto& wvfrm = waveforms[
s];
57 for (
long long int t = 0;
t < numtcks; ++
t) {
58 input_map(
s,
t, 0) = wvfrm[
t];
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
T get(std::string const &key) const
static std::unique_ptr< Graph > create(const char *graph_file_name, const std::vector< std::string > &outputs={}, int ninputs=1, int noutputs=1)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception