Lines Matching refs:shape

22         const Shape shape{};  in TEST()  local
23 EXPECT_EQ(0, shape.ndim()); in TEST()
24 EXPECT_EQ(size_t{0}, shape.size()); in TEST()
27 const Shape shape{2, 3, 4}; in TEST() local
28 EXPECT_EQ(3, shape.ndim()); in TEST()
29 EXPECT_EQ(size_t{3}, shape.size()); in TEST()
30 CheckSpanEqual({2, 3, 4}, shape.span()); in TEST()
31 EXPECT_EQ(2 * 3 * 4, shape.GetTotalSize()); in TEST()
35 const Shape shape{absl::MakeConstSpan(dims)}; in TEST() local
36 EXPECT_EQ(3, shape.ndim()); in TEST()
37 CheckSpanEqual({2, 3, 4}, shape.span()); in TEST()
41 const Shape shape{dims.begin(), dims.end()}; in TEST() local
42 EXPECT_EQ(3, shape.ndim()); in TEST()
43 CheckSpanEqual({2, 3, 4}, shape.span()); in TEST()
46 const Shape shape(std::initializer_list<int64_t>{}); in TEST() local
47 EXPECT_EQ(0, shape.ndim()); in TEST()
48 CheckSpanEqual({}, shape.span()); in TEST()
52 const Shape shape{absl::MakeConstSpan(dims)}; in TEST() local
53 EXPECT_EQ(0, shape.ndim()); in TEST()
54 CheckSpanEqual({}, shape.span()); in TEST()
58 const Shape shape{dims.begin(), dims.end()}; in TEST() local
59 EXPECT_EQ(0, shape.ndim()); in TEST()
60 CheckSpanEqual({}, shape.span()); in TEST()
78 const Shape shape = {2, 3, 4}; in TEST() local
79 EXPECT_EQ(2, shape[0]); in TEST()
80 EXPECT_EQ(3, shape[1]); in TEST()
81 EXPECT_EQ(4, shape[2]); in TEST()
82 EXPECT_THROW(shape[-1], IndexError); in TEST()
83 EXPECT_THROW(shape[3], IndexError); in TEST()
88 const Shape shape = {2, 3, 4}; in TEST() local
90 EXPECT_TRUE(shape == shape2); in TEST()
93 const Shape shape = {2, 3, 4}; in TEST() local
95 EXPECT_TRUE(shape != shape2); in TEST()
98 const Shape shape = {2, 3, 4}; in TEST() local
100 EXPECT_TRUE(shape != shape2); in TEST()
106 const Shape shape = {2, 3, 4}; in TEST() local
108 CheckEqual(shape, shape2); in TEST()
111 const Shape shape = {2, 3, 4}; in TEST() local
113 EXPECT_THROW(CheckEqual(shape, shape2), DimensionError); in TEST()
118 const Shape shape = {2, 3, 4}; in TEST() local
119 … CheckSpanEqual({2, 3, 4}, absl::MakeConstSpan(std::vector<int64_t>{shape.begin(), shape.end()})); in TEST()
120 …CheckSpanEqual({4, 3, 2}, absl::MakeConstSpan(std::vector<int64_t>{shape.rbegin(), shape.rend()})); in TEST()
125 const Shape shape = {}; in TEST() local
126 EXPECT_EQ(shape.ToString(), "()"); in TEST()
129 const Shape shape = {1}; in TEST() local
130 EXPECT_EQ(shape.ToString(), "(1,)"); in TEST()
133 const Shape shape = {2, 3, 4}; in TEST() local
134 EXPECT_EQ(shape.ToString(), "(2, 3, 4)"); in TEST()
139 const Shape shape = {2, 3, 4}; in TEST() local
140 CheckSpanEqual({2, 3, 4}, absl::MakeConstSpan(shape)); in TEST()
145 Shape shape{2, 3, 4}; in TEST() local
146 Strides strides{shape, GetItemSize(Dtype::kFloat32)}; in TEST()
147 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
150 Shape shape{2, 3, 4}; in TEST() local
151 Strides strides{shape, GetItemSize(Dtype::kFloat32)}; in TEST()
152 EXPECT_FALSE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat64))); in TEST()
155 Shape shape{2, 3}; in TEST() local
157 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
160 Shape shape{2, 3, 4}; in TEST() local
162 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
165 Shape shape{2, 3, 4}; in TEST() local
167 EXPECT_FALSE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
170 Shape shape{}; in TEST() local
172 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
175 Shape shape{0}; in TEST() local
177 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
180 Shape shape{0, 0}; in TEST() local
182 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
185 Shape shape{1, 2}; in TEST() local
187 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
190 Shape shape{1, 3}; in TEST() local
192 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
195 Shape shape{1, 2, 4}; in TEST() local
197 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
200 Shape shape{1, 3}; in TEST() local
202 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
205 Shape shape{1, 1, 2, 3}; in TEST() local
207 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
210 Shape shape{1, 1, 2, 3}; in TEST() local
212 EXPECT_FALSE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
215 Shape shape{1, 1, 2}; in TEST() local
217 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
220 Shape shape{1, 2}; in TEST() local
222 EXPECT_TRUE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
225 Shape shape{2, 2}; in TEST() local
227 EXPECT_FALSE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()
230 Shape shape{2, 1, 2}; in TEST() local
232 EXPECT_FALSE(internal::IsContiguous(shape, strides, GetItemSize(Dtype::kFloat32))); in TEST()