| 129 | class BaseSVDFOpModel : public SingleOpModel { |
| 130 | public: |
| 131 | BaseSVDFOpModel(int batches, int units, int input_size, int memory_size, |
| 132 | int rank, |
| 133 | TensorType weights_feature_type = TensorType_FLOAT32, |
| 134 | TensorType weights_time_type = TensorType_FLOAT32) |
| 135 | : batches_(batches), |
| 136 | units_(units), |
| 137 | input_size_(input_size), |
| 138 | memory_size_(memory_size), |
| 139 | rank_(rank) { |
| 140 | input_ = AddInput(TensorType_FLOAT32); |
| 141 | weights_feature_ = AddInput(weights_feature_type); |
| 142 | weights_time_ = AddInput(weights_time_type); |
| 143 | bias_ = AddNullInput(); |
| 144 | const int num_filters = units * rank; |
| 145 | activation_state_ = AddInput( |
| 146 | TensorData{TensorType_FLOAT32, {batches, memory_size * num_filters}}, |
| 147 | /*is_variable=*/true); |
| 148 | output_ = AddOutput(TensorType_FLOAT32); |
| 149 | SetBuiltinOp( |
| 150 | BuiltinOperator_SVDF, BuiltinOptions_SVDFOptions, |
| 151 | CreateSVDFOptions(builder_, rank, ActivationFunctionType_NONE).Union()); |
| 152 | BuildInterpreter({ |
| 153 | {batches_, input_size_}, // input tensor |
| 154 | {units_ * rank, input_size_}, // weights_feature tensor |
| 155 | {units_ * rank, memory_size_}, // weights_time tensor |
| 156 | {units_}, // bias tensor |
| 157 | {batches, memory_size * num_filters} // activation_state tensor |
| 158 | }); |
| 159 | } |
| 160 | |
| 161 | // Populates the weights_feature tensor. |
| 162 | void SetWeightsFeature(std::initializer_list<float> f) { |
nothing calls this directly
no test coverage detected