• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CORE_OPS_AUDIO_SPECTROGRAM_H_
18 #define MINDSPORE_CORE_OPS_AUDIO_SPECTROGRAM_H_
19 #include <map>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 #include "mindapi/base/types.h"
24 #include "ops/base_operator.h"
25 
26 namespace mindspore {
27 namespace ops {
28 constexpr auto kNameAudioSpectrogram = "AudioSpectrogram";
29 /// \brief AudioSpectrogram defined AudioSpectrogram operator prototype.
30 class MIND_API AudioSpectrogram : public BaseOperator {
31  public:
32   MIND_API_BASE_MEMBER(AudioSpectrogram);
33   /// \brief Constructor.
AudioSpectrogram()34   AudioSpectrogram() : BaseOperator(kNameAudioSpectrogram) {}
35 
36   /// \brief Method to init the op's attributes.
37   ///
38   /// \param[in] window_size Define the size of window.
39   /// \param[in] stride Define the step size of window to move.
40   /// \param[in] mag_square Define a boolean value to indicate the output is the magnitude or the square of magnitude.
41   void Init(const int64_t window_size, const int64_t stride, const bool mag_square);
42 
43   /// \brief Method to set window_size attribute.
44   ///
45   /// \param[in] window_size Define the size of window.
46   void set_window_size(const int64_t window_size);
47 
48   /// \brief Method to set stride attribute.
49   ///
50   /// \param[in] stride Define the step size of window to move.
51   void set_stride(const int64_t stride);
52 
53   /// \brief Method to set mag_square attribute.
54   ///
55   /// \param[in] mag_square Define a boolean to indicate the output is the magnitude or the square of magnitude.
56   void set_mag_square(const bool mag_square);
57 
58   /// \brief Method to get  window_size attribute.
59   ///
60   /// \return the size of window.
61   int64_t get_window_size() const;
62 
63   /// \brief Method to get stride attribute.
64   ///
65   /// \return the step size.
66   int64_t get_stride() const;
67 
68   /// \brief Method to get mag_square attribute.
69   ///
70   /// \return a boolean value.
71   bool get_mag_square() const;
72 };
73 MIND_API abstract::AbstractBasePtr AudioSpectrogramInfer(const abstract::AnalysisEnginePtr &,
74                                                          const PrimitivePtr &primitive,
75                                                          const std::vector<abstract::AbstractBasePtr> &input_args);
76 }  // namespace ops
77 }  // namespace mindspore
78 
79 #endif  // MINDSPORE_CORE_OPS_AUDIO_SPECTROGRAM_H_
80