ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir_interpreter::MIRInterpreter Class Reference

#include <MirInterpreter.h>

Collaboration diagram for mir_interpreter::MIRInterpreter:

Public Member Functions

 MIRInterpreter ()=default
 
 ~MIRInterpreter () override=default
 
void setTensor (const mir::Operation::Output *output, mir::TensorVariant tensor)
 Set tensor to the interpreter environment.
 
const mir::TensorVariantgetTensor (const mir::Operation::Output *) const
 Get tensor from the interpreter environment.
 
void visit (mir::ops::AddOp &op) override
 
void visit (mir::ops::AbsOp &op) override
 
void visit (mir::ops::AvgPool2DOp &op) override
 
void visit (mir::ops::CappedReluOp &op) override
 
void visit (mir::ops::ConcatOp &op) override
 
void visit (mir::ops::ConstantOp &op) override
 
void visit (mir::ops::Conv2DOp &op) override
 
void visit (mir::ops::DeConv2DOp &op) override
 
void visit (mir::ops::DepthwiseConv2DOp &op) override
 
void visit (mir::ops::DequantizeOp &op) override
 
void visit (mir::ops::DivOp &op) override
 
void visit (mir::ops::EluOp &op) override
 
void visit (mir::ops::EqualOp &op) override
 
void visit (mir::ops::FullyConnectedOp &op) override
 
void visit (mir::ops::GatherOp &op) override
 
void visit (mir::ops::GreaterOp &op) override
 
void visit (mir::ops::HardSwishOp &op) override
 
void visit (mir::ops::InputOp &op) override
 
void visit (mir::ops::LeakyReluOp &op) override
 
void visit (mir::ops::LessOp &op) override
 
void visit (mir::ops::MaxOp &op) override
 
void visit (mir::ops::MaxPool2DOp &op) override
 
void visit (mir::ops::MulOp &op) override
 
void visit (mir::ops::OutputOp &op) override
 
void visit (mir::ops::PadOp &op) override
 
void visit (mir::ops::QuantizeOp &op) override
 
void visit (mir::ops::ReduceMeanOp &op) override
 
void visit (mir::ops::ReluOp &op) override
 
void visit (mir::ops::ReshapeOp &op) override
 
void visit (mir::ops::ResizeOp &op) override
 
void visit (mir::ops::SigmoidOp &op) override
 
void visit (mir::ops::SliceOp &op) override
 
void visit (mir::ops::SoftmaxOp &op) override
 
void visit (mir::ops::SqrtOp &op) override
 
void visit (mir::ops::SqueezeOp &op) override
 
void visit (mir::ops::SubOp &op) override
 
void visit (mir::ops::TanhOp &op) override
 
void visit (mir::ops::TransposeOp &op) override
 
void visit (mir::ops::BroadcastOp &op) override
 
- Public Member Functions inherited from mir::IVisitor
virtual ~IVisitor ()=default
 

Protected Member Functions

void visit_fallback (mir::Operation &op) override
 

Detailed Description

Definition at line 29 of file MirInterpreter.h.

Constructor & Destructor Documentation

◆ MIRInterpreter()

mir_interpreter::MIRInterpreter::MIRInterpreter ( )
explicitdefault

◆ ~MIRInterpreter()

mir_interpreter::MIRInterpreter::~MIRInterpreter ( )
overridedefault

Member Function Documentation

◆ getTensor()

const TensorVariant & mir_interpreter::MIRInterpreter::getTensor ( const mir::Operation::Output ) const

Get tensor from the interpreter environment.

Definition at line 88 of file MirInterpreter.cpp.

89{
90 const auto it = _tensors.find(output);
91 if (it == _tensors.end())
92 {
93 const std::string &name = output->getName();
94 throw std::runtime_error("Can't find data for tensor \"" + name + "\".");
95 }
96 return it->second;
97}

◆ setTensor()

void mir_interpreter::MIRInterpreter::setTensor ( const mir::Operation::Output output,
mir::TensorVariant  tensor 
)

Set tensor to the interpreter environment.

Definition at line 67 of file MirInterpreter.cpp.

68{
69 const auto result = _tensors.emplace(output, std::move(tensor));
70 if (!result.second)
71 {
72 const std::string &name = output->getName();
73 throw std::runtime_error("Attempt to overwrite data for tensor \"" + name + "\".");
74 }
75}
result
Definition infer.py:103

Referenced by visit().

◆ visit() [1/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::AbsOp op)
override

Definition at line 404 of file MirInterpreter.cpp.

405{
406 auto inputs = getInputTensors(op);
407 auto outputs = allocateOutputTensors(op);
408 Abs(inputs[0], outputs[0]);
409}
void Abs(const mir::TensorVariant &arg, mir::TensorVariant &result)
Definition Abs.cpp:50

References mir_interpreter::Abs().

◆ visit() [2/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::AddOp op)
override

Definition at line 327 of file MirInterpreter.cpp.

328{
329 auto inputs = getInputTensors(op);
330 auto outputs = allocateOutputTensors(op);
331 Add(inputs[0], inputs[1], outputs[0]);
332}
void Add(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Add.cpp:121

References mir_interpreter::Add().

◆ visit() [3/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::AvgPool2DOp op)
override

Definition at line 126 of file MirInterpreter.cpp.

127{
128 auto inputs = getInputTensors(op);
129 auto outputs = allocateOutputTensors(op);
130 AvgPool2D(op, inputs[0], outputs[0]);
131}

References AvgPool2D.

◆ visit() [4/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::BroadcastOp op)
override

Definition at line 411 of file MirInterpreter.cpp.

412{
413 auto inputs = getInputTensors(op);
414 auto outputs = allocateOutputTensors(op);
415 outputs[0].get() = TensorVariant{inputs[0], op.getOutputShape(0)};
416}
const Shape & getOutputShape(std::size_t index) const
Definition Operation.h:163

References mir::Operation::getOutputShape().

◆ visit() [5/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::CappedReluOp op)
override

Definition at line 202 of file MirInterpreter.cpp.

203{
204 auto args = getInputTensors(op);
205 auto results = allocateOutputTensors(op);
206 CappedReLU(args[0], op.getCap(), results[0]);
207}
args
Definition infer.py:21
void CappedReLU(const mir::TensorVariant &arg, float cap, mir::TensorVariant &result)

References mir_interpreter::CappedReLU(), and mir::ops::CappedReluOp::getCap().

◆ visit() [6/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ConcatOp op)
override

Definition at line 135 of file MirInterpreter.cpp.

136{
137 auto inputs = getInputTensors(op);
138 auto outputs = allocateOutputTensors(op);
139 Concat(inputs, op.getAxis(), outputs[0]);
140}
int32_t getAxis() const
Definition ConcatOp.h:44
void Concat(const std::vector< std::reference_wrapper< const mir::TensorVariant > > &inputs, int axis, mir::TensorVariant &output)
Definition Concat.cpp:166

References mir_interpreter::Concat(), and mir::ops::ConcatOp::getAxis().

◆ visit() [7/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ConstantOp op)
override

Definition at line 133 of file MirInterpreter.cpp.

133{ setTensor(op.getOutput(0), op.getValue()); }
Output * getOutput(std::size_t index)
Definition Operation.h:149
const TensorVariant & getValue() const
Definition ConstantOp.h:36
void setTensor(const mir::Operation::Output *output, mir::TensorVariant tensor)
Set tensor to the interpreter environment.

References mir::Operation::getOutput(), mir::ops::ConstantOp::getValue(), and setTensor().

◆ visit() [8/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::Conv2DOp op)
override

Definition at line 142 of file MirInterpreter.cpp.

143{
144 auto inputs = getInputTensors(op);
145 auto outputs = allocateOutputTensors(op);
146 const mir::TensorVariant *bias = nullptr;
147 if (inputs.size() > 2)
148 {
149 bias = &(inputs[2].get());
150 }
151 Conv2D(inputs[0], inputs[1], op.getAttributes(), outputs[0], bias);
152}
const Conv2DOpAttributes & getAttributes() const
Definition Conv2DOp.h:62
void Conv2D(const mir::TensorVariant &input, const mir::TensorVariant &kernel, const mir::Conv2DOpAttributes &attributes, mir::TensorVariant &result, const mir::TensorVariant *fused_bias)
Definition Conv2D.cpp:254

References mir_interpreter::Conv2D(), and mir::ops::Conv2DOp::getAttributes().

◆ visit() [9/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::DeConv2DOp op)
override

Definition at line 236 of file MirInterpreter.cpp.

237{
238 auto inputs = getInputTensors(op);
239 auto outputs = allocateOutputTensors(op);
240 DeConv2D(inputs[0], inputs[1], op.getAttributes(), outputs[0]);
241}
const Deconv2DOpAttributes & getAttributes() const
Definition Deconv2DOp.h:68
void DeConv2D(const TensorVariant &input, const TensorVariant &kernel, const Deconv2DOpAttributes &attributes, TensorVariant &output)
Transposed convolution (or Deconvolution)
Definition DeConv2D.cpp:116

References mir_interpreter::DeConv2D(), and mir::ops::DeConv2DOp::getAttributes().

◆ visit() [10/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::DepthwiseConv2DOp op)
override

Definition at line 209 of file MirInterpreter.cpp.

210{
211 auto inputs = getInputTensors(op);
212 auto outputs = allocateOutputTensors(op);
213 const mir::TensorVariant *bias = nullptr;
214 if (inputs.size() > 2)
215 {
216 bias = &inputs[3].get();
217 }
218 DepthwiseConv2D(op, inputs[0], inputs[1], outputs[0], bias);
219}

References DepthwiseConv2D.

◆ visit() [11/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::DequantizeOp op)
override

Definition at line 362 of file MirInterpreter.cpp.

363{
364 auto inputs = getInputTensors(op);
365 auto outputs = allocateOutputTensors(op);
366 Dequantize(inputs[0], outputs[0]);
367}
void Dequantize(const TensorVariant &input, TensorVariant &output)

References mir_interpreter::Dequantize().

◆ visit() [12/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::DivOp op)
override

Definition at line 334 of file MirInterpreter.cpp.

335{
336 auto inputs = getInputTensors(op);
337 auto outputs = allocateOutputTensors(op);
338 Div(inputs[0], inputs[1], outputs[0]);
339}
void Div(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Div.cpp:57

References mir_interpreter::Div().

◆ visit() [13/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::EluOp op)
override

Definition at line 243 of file MirInterpreter.cpp.

244{
245 auto args = getInputTensors(op);
246 auto results = allocateOutputTensors(op);
247 ELU(args[0], op.getAlpha(), results[0]);
248}
float getAlpha() const
Definition EluOp.h:40
void ELU(const mir::TensorVariant &arg, float alpha, mir::TensorVariant &result)
Definition ELU.cpp:46

References mir_interpreter::ELU(), and mir::ops::EluOp::getAlpha().

◆ visit() [14/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::EqualOp op)
override

Definition at line 397 of file MirInterpreter.cpp.

398{
399 auto inputs = getInputTensors(op);
400 auto outputs = allocateOutputTensors(op);
401 Equal(inputs[0], inputs[1], outputs[0]);
402}
void Equal(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Equal.cpp:48

References mir_interpreter::Equal().

◆ visit() [15/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::FullyConnectedOp op)
override

Definition at line 190 of file MirInterpreter.cpp.

191{
192 auto inputs = getInputTensors(op);
193 auto outputs = allocateOutputTensors(op);
194 const mir::TensorVariant *bias = nullptr;
195 if (inputs.size() > 2)
196 {
197 bias = &(inputs[3].get());
198 }
199 FullyConnected(inputs[0], inputs[1], op, outputs[0], bias);
200}
void FullyConnected(const mir::TensorVariant &input, const mir::TensorVariant &weights, const mir::ops::FullyConnectedOp &op, mir::TensorVariant &res, const mir::TensorVariant *bias)

References mir_interpreter::FullyConnected().

◆ visit() [16/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::GatherOp op)
override

Definition at line 308 of file MirInterpreter.cpp.

309{
310 auto inputs = getInputTensors(op);
311 auto outputs = allocateOutputTensors(op);
312 Gather(inputs[0], inputs[1], op, outputs[0]);
313}
void Gather(const TensorVariant &data, const TensorVariant &indices, const ops::GatherOp &op, TensorVariant &res)
Definition Gather.cpp:86

References mir_interpreter::Gather().

◆ visit() [17/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::GreaterOp op)
override

Definition at line 383 of file MirInterpreter.cpp.

384{
385 auto inputs = getInputTensors(op);
386 auto outputs = allocateOutputTensors(op);
387 Greater(inputs[0], inputs[1], outputs[0]);
388}
void Greater(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Greater.cpp:48

References mir_interpreter::Greater().

◆ visit() [18/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::HardSwishOp op)
override

Definition at line 376 of file MirInterpreter.cpp.

377{
378 auto inputs = getInputTensors(op);
379 auto outputs = allocateOutputTensors(op);
380 HardSwish(inputs[0], outputs[0]);
381}
void HardSwish(const mir::TensorVariant &input, mir::TensorVariant &result)
Definition HardSwish.cpp:49

References mir_interpreter::HardSwish().

◆ visit() [19/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::InputOp op)
override

Definition at line 121 of file MirInterpreter.cpp.

122{
123 assert(_tensors.find(op.getOutput(0)) != _tensors.end());
124}

References mir::Operation::getOutput().

◆ visit() [20/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::LeakyReluOp op)
override

Definition at line 315 of file MirInterpreter.cpp.

316{
317 auto args = getInputTensors(op);
318 auto results = allocateOutputTensors(op);
319 LeakyReLU(args[0], op.getAlpha(), results[0]);
320}
float getAlpha() const
Definition LeakyReluOp.h:41
void LeakyReLU(const mir::TensorVariant &arg, float alpha, mir::TensorVariant &result)
Definition LeakyReLU.cpp:44

References mir::ops::LeakyReluOp::getAlpha(), and mir_interpreter::LeakyReLU().

◆ visit() [21/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::LessOp op)
override

Definition at line 390 of file MirInterpreter.cpp.

391{
392 auto inputs = getInputTensors(op);
393 auto outputs = allocateOutputTensors(op);
394 Less(inputs[0], inputs[1], outputs[0]);
395}
void Less(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Less.cpp:48

References mir_interpreter::Less().

◆ visit() [22/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::MaxOp op)
override

Definition at line 341 of file MirInterpreter.cpp.

342{
343 auto inputs = getInputTensors(op);
344 auto outputs = allocateOutputTensors(op);
345 Max(inputs[0], inputs[1], outputs[0]);
346}

References Max.

◆ visit() [23/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::MaxPool2DOp op)
override

Definition at line 154 of file MirInterpreter.cpp.

155{
156 auto inputs = getInputTensors(op);
157 auto outputs = allocateOutputTensors(op);
158 MaxPool2D(inputs[0], op, outputs[0]);
159}

References MaxPool2D.

◆ visit() [24/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::MulOp op)
override

Definition at line 348 of file MirInterpreter.cpp.

349{
350 auto inputs = getInputTensors(op);
351 auto outputs = allocateOutputTensors(op);
352 Mul(inputs[0], inputs[1], outputs[0]);
353}
void Mul(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Mul.cpp:56

References mir_interpreter::Mul().

◆ visit() [25/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::OutputOp op)
override

Definition at line 322 of file MirInterpreter.cpp.

323{
324 assert(_tensors.find(op.getInput(0)) != _tensors.end());
325}
Output * getInput(std::size_t index)
Definition Operation.h:137

References mir::Operation::getInput().

◆ visit() [26/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::PadOp op)
override

Definition at line 258 of file MirInterpreter.cpp.

259{
260 auto inputs = getInputTensors(op);
261 auto outputs = allocateOutputTensors(op);
262 Pad(inputs[0], op, outputs[0]);
263}
void Pad(const mir::TensorVariant &input, const mir::ops::PadOp &op, mir::TensorVariant &result)
Implements PadOp for interpreter backend.
Definition Pad.cpp:79

References mir_interpreter::Pad().

◆ visit() [27/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::QuantizeOp op)
override

Definition at line 369 of file MirInterpreter.cpp.

370{
371 auto inputs = getInputTensors(op);
372 auto outputs = allocateOutputTensors(op);
373 Quantize(inputs[0], outputs[0]);
374}
void Quantize(const TensorVariant &input, TensorVariant &output)

References mir_interpreter::Quantize().

◆ visit() [28/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ReduceMeanOp op)
override

Definition at line 294 of file MirInterpreter.cpp.

295{
296 auto inputs = getInputTensors(op);
297 auto outputs = allocateOutputTensors(op);
298 ReduceMean(inputs[0], op, outputs[0]);
299}
void ReduceMean(const mir::TensorVariant &input, const mir::ops::ReduceMeanOp &op, mir::TensorVariant &output)

References mir_interpreter::ReduceMean().

◆ visit() [29/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ReluOp op)
override

Definition at line 168 of file MirInterpreter.cpp.

169{
170 auto args = getInputTensors(op);
171 auto results = allocateOutputTensors(op);
172 ReLU(args[0], results[0]);
173}
void ReLU(const mir::TensorVariant &arg, mir::TensorVariant &result)
Definition ReLU.cpp:53

References mir_interpreter::ReLU().

◆ visit() [30/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ReshapeOp op)
override

Definition at line 161 of file MirInterpreter.cpp.

162{
163 auto inputs = getInputTensors(op);
164 auto outputs = allocateOutputTensors(op);
165 Reshape(inputs[0], outputs[0]);
166}
void Reshape(const mir::TensorVariant &input, mir::TensorVariant &output)
Definition Reshape.cpp:26

References mir_interpreter::Reshape().

◆ visit() [31/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::ResizeOp op)
override

Definition at line 272 of file MirInterpreter.cpp.

273{
274 // TODO support types other than float32
275 auto inputs = getInputTensors(op);
276 assert(inputs[0].get().getElementType() == mir::DataType::FLOAT32);
277 auto outputs = allocateOutputTensors(op);
278
279 Tensor<float> input(inputs[0]);
280 assert(op.getMode() == ops::ResizeOp::ResizeMethod::nearestNeighbor);
281
282 auto scales = op.getScales();
283 Fill(outputs[0], [&scales, &input](const Index &id) {
284 Index in_idx;
285 in_idx.resize(4);
286 for (int i = 0; i < input.getShape().rank(); i++)
287 {
288 in_idx.at(i) = static_cast<int>(floorf(id.at(i) / scales[i]));
289 }
290 return input.at(in_idx);
291 });
292}
const std::vector< float > & getScales() const
Definition ResizeOp.h:77
ResizeMethod getMode() const
Definition ResizeOp.h:75
KnobTrait< K >::ValueType get(void)
constexpr DataType getElementType()
Definition TestUtils.h:134
void Fill(mir::TensorVariant &t, F f)
Definition Fill.h:41

References mir::Index::at(), mir_interpreter::Fill(), mir::ops::ResizeOp::getMode(), mir::ops::ResizeOp::getScales(), and mir::Index::resize().

◆ visit() [32/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SigmoidOp op)
override

Definition at line 175 of file MirInterpreter.cpp.

176{
177 auto args = getInputTensors(op);
178 auto results = allocateOutputTensors(op);
179 Sigmoid(args[0], results[0]);
180}
void Sigmoid(const mir::TensorVariant &arg, mir::TensorVariant &result)
Definition Sigmoid.cpp:53

References mir_interpreter::Sigmoid().

◆ visit() [33/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SliceOp op)
override

Definition at line 221 of file MirInterpreter.cpp.

222{
223 auto inputs = getInputTensors(op);
224 auto input = inputs[0];
225 auto outputs = allocateOutputTensors(op);
226 Slice(input, op.getStarts(), outputs[0]);
227}
const Shape & getStarts()
Definition SliceOp.h:41
void Slice(const mir::TensorVariant &arg, const mir::Shape &starts, mir::TensorVariant &res)
Definition Slice.cpp:47

References mir::ops::SliceOp::getStarts(), and mir_interpreter::Slice().

◆ visit() [34/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SoftmaxOp op)
override

Definition at line 182 of file MirInterpreter.cpp.

183{
184 auto inputs = getInputTensors(op);
185 assert(inputs.size() == 1);
186 auto outputs = allocateOutputTensors(op);
187 Softmax(inputs[0], op.getAxis(), outputs[0]);
188}
int32_t getAxis() const
Definition SoftmaxOp.h:43
void Softmax(const mir::TensorVariant &arg, int axis, mir::TensorVariant &result)
Definition Softmax.cpp:150

References mir::ops::SoftmaxOp::getAxis(), and mir_interpreter::Softmax().

◆ visit() [35/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SqrtOp op)
override

Definition at line 265 of file MirInterpreter.cpp.

266{
267 auto args = getInputTensors(op);
268 auto results = allocateOutputTensors(op);
269 Sqrt(args[0], results[0]);
270}
void Sqrt(const mir::TensorVariant &arg, mir::TensorVariant &result)
Definition Sqrt.cpp:53

References mir_interpreter::Sqrt().

◆ visit() [36/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SqueezeOp op)
override

Definition at line 250 of file MirInterpreter.cpp.

251{
252 auto inputs = getInputTensors(op);
253 auto outputs = allocateOutputTensors(op);
254 // Squeeze is just a special case of reshape.
255 Reshape(inputs[0], outputs[0]);
256}

References mir_interpreter::Reshape().

◆ visit() [37/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::SubOp op)
override

Definition at line 355 of file MirInterpreter.cpp.

356{
357 auto inputs = getInputTensors(op);
358 auto outputs = allocateOutputTensors(op);
359 Sub(inputs[0], inputs[1], outputs[0]);
360}
void Sub(const TensorVariant &lhs, const TensorVariant &rhs, TensorVariant &res)
Definition Sub.cpp:56

References mir_interpreter::Sub().

◆ visit() [38/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::TanhOp op)
override

Definition at line 229 of file MirInterpreter.cpp.

230{
231 auto args = getInputTensors(op);
232 auto results = allocateOutputTensors(op);
233 Tanh(args[0], results[0]);
234}
void Tanh(const mir::TensorVariant &arg, mir::TensorVariant &result)
Definition Tanh.cpp:53

References mir_interpreter::Tanh().

◆ visit() [39/39]

void mir_interpreter::MIRInterpreter::visit ( mir::ops::TransposeOp op)
override

Definition at line 301 of file MirInterpreter.cpp.

302{
303 auto inputs = getInputTensors(op);
304 auto outputs = allocateOutputTensors(op);
305 Transpose(inputs[0], op, outputs[0]);
306}
void Transpose(const mir::TensorVariant &input, const mir::ops::TransposeOp &op, mir::TensorVariant &output)
Definition Transpose.cpp:58

References mir_interpreter::Transpose().

◆ visit_fallback()

void mir_interpreter::MIRInterpreter::visit_fallback ( mir::Operation op)
overrideprotectedvirtual

Reimplemented from mir::Visitor.

Definition at line 418 of file MirInterpreter.cpp.

418{ throw std::runtime_error("NYI operation"); }

The documentation for this class was generated from the following files: