Merge pull request #2102 from zh794390558/format

[audio] format and cpplint
pull/2108/head
Hui Zhang 3 years ago committed by GitHub
commit da6692c7b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,7 +45,7 @@ exec 1>&2
cpplint=cpplint cpplint=cpplint
sum=0 sum=0
filters='-build/include_order,-build/namespaces,-legal/copyright,-runtime/references,-build/include_what_you_use' filters='-build/include_order,-build/namespaces,-legal/copyright,-runtime/references,-build/include_what_you_use,-whitespace/indent,-build/header_guard'
# for cpp # for cpp
for file in $(git diff-index --name-status $against -- | grep -E '\.[ch](pp)?$' | awk '{print $2}'); do for file in $(git diff-index --name-status $against -- | grep -E '\.[ch](pp)?$' | awk '{print $2}'); do

@ -108,9 +108,11 @@ def is_soundfile_available():
def requires_soundfile(): def requires_soundfile():
if is_soundfile_available(): if is_soundfile_available():
def decorator(func): def decorator(func):
return func return func
else: else:
def decorator(func): def decorator(func):
@wraps(func) @wraps(func)
def wrapped(*args, **kwargs): def wrapped(*args, **kwargs):
@ -128,9 +130,11 @@ def is_sox_available():
def requires_sox(): def requires_sox():
if is_sox_available(): if is_sox_available():
def decorator(func): def decorator(func):
return func return func
else: else:
def decorator(func): def decorator(func):
@wraps(func) @wraps(func)
def wrapped(*args, **kwargs): def wrapped(*args, **kwargs):

@ -72,15 +72,15 @@ bool StreamingFeatureTpl<F>::Compute(
for (::kaldi::int32 frame = 0; frame < num_frames; frame++) { for (::kaldi::int32 frame = 0; frame < num_frames; frame++) {
::kaldi::BaseFloat raw_log_energy = 0.0; ::kaldi::BaseFloat raw_log_energy = 0.0;
::kaldi::ExtractWindow(0, ::kaldi::ExtractWindow(0,
waves, waves,
frame, frame,
frame_opts, frame_opts,
window_function_, window_function_,
&window, &window,
need_raw_log_energy ? &raw_log_energy : NULL); need_raw_log_energy ? &raw_log_energy : NULL);
::kaldi::Vector<::kaldi::BaseFloat> this_feature(computer_.Dim(), ::kaldi::Vector<::kaldi::BaseFloat> this_feature(computer_.Dim(),
::kaldi::kUndefined); ::kaldi::kUndefined);
computer_.Compute(raw_log_energy, vtln_warp, &window, &this_feature); computer_.Compute(raw_log_energy, vtln_warp, &window, &this_feature);
::kaldi::SubVector<::kaldi::BaseFloat> output_row( ::kaldi::SubVector<::kaldi::BaseFloat> output_row(
feats->Data() + frame * Dim(), Dim()); feats->Data() + frame * Dim(), Dim());

@ -77,7 +77,8 @@ bool InitFbank(float samp_freq, // frame opts
} }
py::array_t<double> ComputeFbankStreaming(const py::array_t<double>& wav) { py::array_t<double> ComputeFbankStreaming(const py::array_t<double>& wav) {
return paddleaudio::kaldi::KaldiFeatureWrapper::GetInstance()->ComputeFbank(wav); return paddleaudio::kaldi::KaldiFeatureWrapper::GetInstance()->ComputeFbank(
wav);
} }
py::array_t<double> ComputeFbank( py::array_t<double> ComputeFbank(
@ -144,5 +145,5 @@ void ResetFbank() {
paddleaudio::kaldi::KaldiFeatureWrapper::GetInstance()->ResetFbank(); paddleaudio::kaldi::KaldiFeatureWrapper::GetInstance()->ResetFbank();
} }
} // kaldi } // namespace kaldi
} // paddleaudio } // namespace paddleaudio

@ -16,6 +16,7 @@
#include <pybind11/numpy.h> #include <pybind11/numpy.h>
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <string>
#include "paddlespeech/audio/src/pybind/kaldi/kaldi_feature_wrapper.h" #include "paddlespeech/audio/src/pybind/kaldi/kaldi_feature_wrapper.h"
@ -88,5 +89,5 @@ py::array_t<double> ComputeFbankStreaming(const py::array_t<double>& wav);
py::array_t<double> TestFun(const py::array_t<double>& wav); py::array_t<double> TestFun(const py::array_t<double>& wav);
} // namespace kaldi } // namespace kaldi
} // namespace paddleaudio } // namespace paddleaudio

@ -36,5 +36,5 @@ class KaldiFeatureWrapper {
std::unique_ptr<paddleaudio::kaldi::Fbank> fbank_; std::unique_ptr<paddleaudio::kaldi::Fbank> fbank_;
}; };
} // namespace kaldi } // namespace kaldi
} // namespace paddleaudio } // namespace paddleaudio

@ -1,8 +1,8 @@
// Copyright (c) 2017 Facebook Inc. (Soumith Chintala), All rights reserved. // Copyright (c) 2017 Facebook Inc. (Soumith Chintala), All rights reserved.
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#include "paddlespeech/audio/src/pybind/sox/io.h"
#include "paddlespeech/audio/src/pybind/kaldi/kaldi_feature.h" #include "paddlespeech/audio/src/pybind/kaldi/kaldi_feature.h"
#include "paddlespeech/audio/src/pybind/sox/io.h"
// Sox // Sox
PYBIND11_MODULE(_paddleaudio, m) { PYBIND11_MODULE(_paddleaudio, m) {

@ -499,6 +499,15 @@ class SymbolicShapeInference:
'Attention', 'BiasGelu', \ 'Attention', 'BiasGelu', \
'EmbedLayerNormalization', \ 'EmbedLayerNormalization', \
'FastGelu', 'Gelu', 'LayerNormalization', \ 'FastGelu', 'Gelu', 'LayerNormalization', \

@ -35,7 +35,8 @@ def _get_build(var, default=False):
_BUILD_SOX = False if platform.system() == "Windows" else _get_build( _BUILD_SOX = False if platform.system() == "Windows" else _get_build(
"BUILD_SOX", True) "BUILD_SOX", True)
_BUILD_MAD = _get_build("BUILD_MAD", False) _BUILD_MAD = _get_build("BUILD_MAD", False)
_BUILD_KALDI = False if platform.system() == "Windows" else _get_build("BUILD_KALDI", True) _BUILD_KALDI = False if platform.system() == "Windows" else _get_build(
"BUILD_KALDI", True)
# _BUILD_RNNT = _get_build("BUILD_RNNT", True) # _BUILD_RNNT = _get_build("BUILD_RNNT", True)
# _BUILD_CTC_DECODER = False if platform.system() == "Windows" else _get_build("BUILD_CTC_DECODER", True) # _BUILD_CTC_DECODER = False if platform.system() == "Windows" else _get_build("BUILD_CTC_DECODER", True)
# _USE_FFMPEG = _get_build("USE_FFMPEG", False) # _USE_FFMPEG = _get_build("USE_FFMPEG", False)

Loading…
Cancel
Save