MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Tile

Class Tile

tensorflow/compiler/xla/layout.h:33–80  ·  view source on GitHub ↗

Describes a tile used in tiling-based layout. Refer to g3doc/third_party/tensorflow/compiler/xla/g3doc/tiled_layout.md for details.

Source from the content-addressed store, hash-verified

31// g3doc/third_party/tensorflow/compiler/xla/g3doc/tiled_layout.md for
32// details.
33class Tile {
34 public:
35 Tile() = default;
36 explicit Tile(absl::Span<const int64> dimensions)
37 : dimensions_(dimensions.begin(), dimensions.end()) {}
38
39 // De/Serialize a Tile to and from a TileProto.
40 static Tile CreateFromProto(const TileProto& tile_proto) {
41 return Tile(AsInt64Slice(tile_proto.dimensions()));
42 }
43 TileProto ToProto() const;
44
45 bool operator==(const Tile& other) const {
46 return dimensions() == other.dimensions();
47 }
48 bool operator!=(const Tile& other) const { return !(*this == other); }
49
50 string ToString() const;
51
52 // Returns the bound of the tile in the given dimension index.
53 int64 dimension(int i) const { return dimensions_.at(i); }
54
55 // Returns the dimensions of the tile.
56 absl::Span<const int64> dimensions() const { return dimensions_; }
57
58 Tile& add_dimensions(int64 value) {
59 dimensions_.push_back(value);
60 return *this;
61 }
62
63 Tile& clear_dimensions() {
64 dimensions_.clear();
65 return *this;
66 }
67
68 // This dimension size means the corresponding dimension in the shape is
69 // combined with the next minor dimension before tiling is applied.
70 static constexpr int64 kCombineDimension = std::numeric_limits<int64>::min();
71
72 template <typename H>
73 friend H AbslHashValue(H h, const Tile& t) {
74 return H::combine(std::move(h), t.dimensions_);
75 }
76
77 private:
78 // The bounds of the tile.
79 absl::InlinedVector<int64, 2> dimensions_;
80};
81
82class Layout {
83 public:

Callers 9

ShapeTestClass · 0.70
TEST_FFunction · 0.70
CreateFromProtoMethod · 0.70
add_tilesMethod · 0.70
TEST_FFunction · 0.50
GetBatchIndicesFunction · 0.50
SumGradHelperFunction · 0.50
ProdGradFunction · 0.50
GetIsPositiveFunction · 0.50

Calls 3

minFunction · 0.50
push_backMethod · 0.45
clearMethod · 0.45

Tested by 2

TEST_FFunction · 0.56
TEST_FFunction · 0.40