tile.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 Intel Corporation
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 #pragma once
18 
19 #include "ngraph/op/op.hpp"
20 #include "ngraph/runtime/host_tensor.hpp"
21 
22 namespace ngraph
23 {
24  namespace op
25  {
26  namespace v0
27  {
28  /// \brief Dynamic Tiling operation which repeats a tensor multiple times
29  /// along each dimension
30  class NGRAPH_API Tile : public Op
31  {
32  public:
33  static constexpr NodeTypeInfo type_info{"Tile", 0};
34  const NodeTypeInfo& get_type_info() const override { return type_info; }
35  Tile() = default;
36  /// \brief Perform dynamic padding of a tensor
37  ///
38  /// \param data The node producing input tensor to be padded.
39  /// \param repeats The node producing the per-dimension replication factor
40  Tile(const Output<Node>& data, const Output<Node>& repeats);
41 
42  bool visit_attributes(AttributeVisitor& visitor) override;
43  void validate_and_infer_types() override;
44 
45  virtual std::shared_ptr<Node>
46  clone_with_new_inputs(const OutputVector& new_args) const override;
47 
48  bool evaluate(const HostTensorVector& outputs,
49  const HostTensorVector& inputs) const override;
50 
51  private:
52  bool evaluate_tile(const HostTensorVector& outputs,
53  const HostTensorVector& inputs) const;
54  };
55  }
56  }
57 }
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Root of all actual ops.
Definition: op.hpp:29
Dynamic Tiling operation which repeats a tensor multiple times along each dimension.
Definition: tile.hpp:31
Tile(const Output< Node > &data, const Output< Node > &repeats)
Perform dynamic padding of a tensor.
const NodeTypeInfo & get_type_info() const override
Definition: tile.hpp:34
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: type.hpp:39