Home
last modified time | relevance | path

Searched refs:shape (Results 1 – 25 of 5439) sorted by relevance

12345678910>>...218

/external/llvm-project/mlir/test/Dialect/Shape/
Dops.mlir7 func @shape_num_elements(%shape : !shape.shape) -> !shape.size {
8 %init = shape.const_size 1
9 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
10 ^bb0(%index : index, %extent : !shape.size, %acc : !shape.size):
11 %acc_next = shape.mul %acc, %extent
12 : !shape.size, !shape.size -> !shape.size
13 shape.yield %acc_next : !shape.size
15 return %num_elements : !shape.size
19 func @extent_tensor_num_elements(%shape : tensor<?xindex>) -> index {
21 %num_elements = shape.reduce(%shape, %init) : tensor<?xindex> -> index {
[all …]
Dcanonicalize.mlir5 // CHECK: shape.const_shape [2, 3, 4] : tensor<?xindex>
6 %0 = shape.shape_of %arg0 : tensor<2x3x4xf32> -> tensor<?xindex>
14 func @f() -> (!shape.shape, !shape.shape) {
15 // CHECK: shape.const_shape [2, 3] : !shape.shape
16 // CHECK: shape.const_shape [4, 5] : !shape.shape
18 %0 = shape.const_shape [2, 3, 4, 5] : !shape.shape
19 %head, %tail = "shape.split_at"(%0, %c2) : (!shape.shape, i32) -> (!shape.shape, !shape.shape)
20 return %head, %tail : !shape.shape, !shape.shape
28 func @f() -> (!shape.shape, !shape.shape) {
29 // CHECK: shape.const_shape [2, 3, 4] : !shape.shape
[all …]
Dinvalid.mlir3 func @reduce_op_args_num_mismatch(%shape : !shape.shape, %init : !shape.size) {
5 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
6 ^bb0(%index: index, %dim: !shape.size):
7 shape.yield %dim : !shape.size
14 func @reduce_op_arg0_wrong_type(%shape : !shape.shape, %init : !shape.size) {
16 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
17 ^bb0(%index: f32, %dim: !shape.size, %acc: !shape.size):
18 %new_acc = "shape.add"(%acc, %dim)
19 : (!shape.size, !shape.size) -> !shape.size
20 shape.yield %new_acc : !shape.size
[all …]
Dremove-shape-constraints.mlir1 // RUN: mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints -canonical…
2 // RUN: mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints <%s | File…
8 func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index {
9 // REPLACE-NEXT: %[[WITNESS:.+]] = shape.const_witness true
10 // REPLACE-NOT: shape.cstr_eq
11 // REPLACE: shape.assuming %[[WITNESS]]
14 %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape
15 %1 = shape.assuming %0 -> index {
17 shape.assuming_yield %2 : index
26 func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index {
[all …]
Dshape-to-shape.mlir1 // RUN: mlir-opt -shape-to-shape-lowering -split-input-file %s | FileCheck %s
4 // CHECK-SAME: ([[ARG:%.*]]: !shape.shape) -> !shape.size
5 func @num_elements_to_reduce(%shape : !shape.shape) -> !shape.size {
6 %num_elements = shape.num_elements %shape : !shape.shape -> !shape.size
7 return %num_elements : !shape.size
9 // CHECK: [[C1:%.*]] = shape.const_size 1
10 // CHECK: [[NUM_ELEMENTS:%.*]] = shape.reduce([[ARG]], [[C1]]) : !shape.shape -> !shape.size
11 // CHECK: ^bb0({{.*}}: index, [[DIM:%.*]]: !shape.size, [[ACC:%.*]]: !shape.size
12 // CHECK: [[NEW_ACC:%.*]] = shape.mul [[DIM]], [[ACC]]
13 // CHECK: shape.yield [[NEW_ACC]] : !shape.size
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/common/
Dconvert.cc43 absl::Status ConvertToPHWO4I4(absl::Span<const float> in, const OHWI& shape, in ConvertToPHWO4I4() argument
45 if (in.size() != shape.DimensionsProduct()) { in ConvertToPHWO4I4()
48 in.size(), " != ", shape.DimensionsProduct())); in ConvertToPHWO4I4()
50 if (out.size() != GetElementsSizeForPHWO4I4(shape)) { in ConvertToPHWO4I4()
53 out.size(), " != ", GetElementsSizeForPHWO4I4(shape))); in ConvertToPHWO4I4()
57 for (int p = 0; p < DivideRoundUp(shape.o, kPhwo4i4ChannelsInPlane); ++p) { in ConvertToPHWO4I4()
58 for (int h = 0; h < shape.h; ++h) { in ConvertToPHWO4I4()
59 for (int w = 0; w < shape.w; ++w) { in ConvertToPHWO4I4()
60 for (int c = 0; c < DivideRoundUp(shape.i, kPhwo4i4ChannelsInPlane); in ConvertToPHWO4I4()
65 if (c * kPhwo4i4ChannelsInPlane + ci < shape.i && in ConvertToPHWO4I4()
[all …]
/external/tensorflow/tensorflow/compiler/xla/
Dshape_util.cc132 TF_ASSIGN_OR_RETURN(Shape shape, in MakeShapeWithLayoutInternal()
139 *shape.mutable_layout() = LayoutUtil::MakeLayout( in MakeShapeWithLayoutInternal()
141 if (!shape.has_layout()) { in MakeShapeWithLayoutInternal()
144 TF_RETURN_IF_ERROR(ShapeUtil::ValidateShape(shape)); in MakeShapeWithLayoutInternal()
145 return shape; in MakeShapeWithLayoutInternal()
195 /* static */ int64 ShapeUtil::TrueRank(const Shape& shape) { in TrueRank() argument
197 for (int64 dimension : shape.dimensions()) { in TrueRank()
208 Shape* shape) { in FillNewShape() argument
221 shape->set_element_type(element_type); in FillNewShape()
223 auto layout = shape->mutable_layout(); in FillNewShape()
[all …]
Dshape_util.h189 IndexedShape(ShapeIndex index, Shape shape) in IndexedShape()
190 : index(std::move(index)), shape(std::move(shape)) {} in IndexedShape()
192 Shape shape; member
198 static int64 ElementsIn(const Shape& shape);
201 static int64 ElementsInRecursive(const Shape& shape);
204 static bool HasPrimitiveType(const Shape& shape,
208 static bool IsZeroElementArray(const Shape& shape);
215 static int64 ByteSizeOf(const Shape& shape, int64 pointer_size = -1);
225 static int64 ByteSizeOfTupleIndexTable(const Shape& shape,
233 static int64 ByteSizeOfElements(const Shape& shape);
[all …]
Dlayout_util_test.cc32 Shape shape = ShapeUtil::MakeShape(element_type, dimensions); in MakeShapeWithLayout() local
33 *shape.mutable_layout() = LayoutUtil::MakeLayout(minor_to_major); in MakeShapeWithLayout()
34 return shape; in MakeShapeWithLayout()
39 Shape shape = in TEST_F() local
45 Shape tuple1 = ShapeUtil::MakeTupleShape({shape}); in TEST_F()
46 Shape tuple2 = ShapeUtil::MakeTupleShape({shape, shape}); in TEST_F()
58 Shape other_tuple2 = ShapeUtil::MakeTupleShape({shape, other_shape}); in TEST_F()
197 Shape shape = ShapeUtil::MakeTupleShape( in TEST_F() local
203 EXPECT_TRUE(LayoutUtil::HasLayout(shape)); in TEST_F()
204 EXPECT_TRUE(shape.tuple_shapes(0).has_layout()); in TEST_F()
[all …]
Dlayout_util.cc117 /* static */ Layout LayoutUtil::GetDefaultLayoutForShape(const Shape& shape) { in GetDefaultLayoutForShape() argument
118 if (shape.IsOpaque() || shape.IsToken()) { in GetDefaultLayoutForShape()
124 CHECK(shape.IsArray()); in GetDefaultLayoutForShape()
125 return CreateDefaultLayoutForRank(shape.dimensions_size()); in GetDefaultLayoutForShape()
144 /* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) { in SetToDefaultLayout() argument
145 if (shape->IsTuple()) { in SetToDefaultLayout()
147 for (auto& element_shape : *shape->mutable_tuple_shapes()) { in SetToDefaultLayout()
150 shape->clear_layout(); in SetToDefaultLayout()
151 } else if (shape->IsArray()) { in SetToDefaultLayout()
152 shape->mutable_layout()->set_format(DENSE); in SetToDefaultLayout()
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/common/task/
Dstorage_type_util.cc26 bool CanCreateTensorWithShape(const GpuInfo& gpu_info, const BHWDC& shape, in CanCreateTensorWithShape() argument
28 const int slices = DivideRoundUp(shape.c, 4); in CanCreateTensorWithShape()
34 shape.b * shape.w * shape.h * shape.d * slices * flt4_size; in CanCreateTensorWithShape()
38 return shape.b * shape.w * shape.h * shape.d * slices <= in CanCreateTensorWithShape()
47 return shape.w * shape.b <= gpu_info.GetMaxImage3DWidth() && in CanCreateTensorWithShape()
48 shape.h <= gpu_info.GetMaxImage3DHeight() && in CanCreateTensorWithShape()
49 slices * shape.d <= gpu_info.GetMaxImage3DDepth(); in CanCreateTensorWithShape()
56 return shape.w * shape.b <= gpu_info.GetMaxImage2DWidth() && in CanCreateTensorWithShape()
57 shape.h <= gpu_info.GetMaxImage2DHeight() && in CanCreateTensorWithShape()
58 slices * shape.d <= gpu_info.GetMaxImage2DArrayLayers(); in CanCreateTensorWithShape()
[all …]
Dweights_conversion.h39 const int dst_slices = DivideRoundUp(weights.shape.o, 4); in RearrangeWeightsToOHWIOGroupI4O4()
40 const int src_slices = DivideRoundUp(weights.shape.i, 4); in RearrangeWeightsToOHWIOGroupI4O4()
45 for (int y = 0; y < weights.shape.h; ++y) { in RearrangeWeightsToOHWIOGroupI4O4()
46 for (int x = 0; x < weights.shape.w; ++x) { in RearrangeWeightsToOHWIOGroupI4O4()
54 if (s_ch < weights.shape.i && d_ch < weights.shape.o) { in RearrangeWeightsToOHWIOGroupI4O4()
56 weights.shape.LinearIndex({d_ch, y, x, s_ch}); in RearrangeWeightsToOHWIOGroupI4O4()
75 const int dst_slices = DivideRoundUp(weights.shape.o, 4); in RearrangeWeightsToOHWIOGroupO4I4()
76 const int src_slices = DivideRoundUp(weights.shape.i, 4); in RearrangeWeightsToOHWIOGroupO4I4()
81 for (int y = 0; y < weights.shape.h; ++y) { in RearrangeWeightsToOHWIOGroupO4I4()
82 for (int x = 0; x < weights.shape.w; ++x) { in RearrangeWeightsToOHWIOGroupO4I4()
[all …]
/external/tflite-support/tensorflow_lite_support/java/src/java/org/tensorflow/lite/support/tensorbuffer/
DTensorBuffer.java34 protected int[] shape; field in TensorBuffer
75 public static TensorBuffer createFixedSize(@NonNull int[] shape, DataType dataType) { in createFixedSize() argument
78 return new TensorBufferFloat(shape); in createFixedSize()
80 return new TensorBufferUint8(shape); in createFixedSize()
121 result = createFixedSize(buffer.shape, dataType); in createFrom()
128 result.loadArray(data, buffer.shape); in createFrom()
131 result.loadArray(data, buffer.shape); in createFrom()
160 return Arrays.copyOf(shape, shape.length); in getShape()
245 public abstract void loadArray(@NonNull int[] src, @NonNull int[] shape); in loadArray() argument
260 loadArray(src, shape); in loadArray()
[all …]
/external/tensorflow/tensorflow/python/ops/
Dinit_ops_v2_test.py40 shape=None, argument
42 if shape is None:
43 shape = [100]
44 t1 = self.evaluate(init1(shape, dtype))
45 t2 = self.evaluate(init2(shape, dtype))
46 self.assertEqual(tensor_shape.as_shape(shape), t1.shape)
47 self.assertEqual(tensor_shape.as_shape(shape), t2.shape)
50 def _duplicated_test(self, init, shape=None, dtype=dtypes.float32): argument
51 if shape is None:
52 shape = [100]
[all …]
Dinit_ops_test.py40 shape, argument
45 output = self.evaluate(init(shape))
46 self.assertEqual(output.shape, shape)
58 shape = (9, 6, 99)
60 for tensor_shape in [shape, tensor_shape_lib.TensorShape(shape)]:
69 shape = (8, 12, 99)
71 for tensor_shape in [shape, tensor_shape_lib.TensorShape(shape)]:
79 shape = (12, 99, 7)
81 for tensor_shape in [shape, tensor_shape_lib.TensorShape(shape)]:
90 shape = (5, 6, 4)
[all …]
Dstateful_random_ops.py77 def non_deterministic_ints(shape, dtype=dtypes.int64): argument
91 shape=shape, dtype=dtype)
120 if len(seed.shape) != 1:
122 "seed should only have one dimension; got shape: %s" % seed.shape)
129 seed_size = seed.shape[0]
135 assert seed.shape == (state_size,), "Wrong seed.shape: %s" % seed.shape
157 def _check_state_shape(shape, alg): argument
160 shape.assert_is_compatible_with([_get_state_size(int(alg))])
219 def _shape_tensor(shape): argument
221 if isinstance(shape, (tuple, list)) and not shape:
[all …]
Drandom_ops.py47 def random_normal(shape, argument
89 with ops.name_scope(name, "random_normal", [shape, mean, stddev]) as name:
90 shape_tensor = tensor_util.shape_tensor(shape)
98 tensor_util.maybe_set_static_shape(value, shape)
105 def parameterized_truncated_normal(shape, argument
140 [shape, means, stddevs, minvals, maxvals]) as name:
141 shape_tensor = tensor_util.shape_tensor(shape)
155 tensor_util.maybe_set_static_shape(rnd, shape)
163 def truncated_normal(shape, argument
198 with ops.name_scope(name, "truncated_normal", [shape, mean, stddev]) as name:
[all …]
/external/tensorflow/tensorflow/compiler/tests/
Dfft_test.py66 shape = BATCH_DIMS + indims
67 data = np.arange(np.prod(shape) * 2) / np.prod(indims)
70 data = np.reshape(data.astype(np.float32).view(np.complex64), shape)
76 dtypes.as_dtype(data.dtype), shape=data.shape)
85 shape = BATCH_DIMS + dims
86 data = np.arange(np.prod(shape)) / np.prod(dims)
89 data = np.reshape(data.astype(np.float32), shape)
98 dtypes.as_dtype(data.dtype), shape=data.shape)
136 return np.fft.rfft(x, n=x.shape[-1])
139 return signal.rfft(x, fft_length=[x.shape[-1]])
[all …]
/external/tensorflow/tensorflow/java/src/main/java/org/tensorflow/
DShape.java55 long[] shape = new long[otherDimensionSizes.length + 1]; in make() local
56 shape[0] = firstDimensionSize; in make()
57 System.arraycopy(otherDimensionSizes, 0, shape, 1, otherDimensionSizes.length); in make()
58 return new Shape(shape); in make()
68 return shape == null ? -1 : shape.length; in numDimensions()
77 return shape[i]; in size()
82 return Arrays.hashCode(shape); in hashCode()
91 if (obj instanceof Shape && Arrays.equals(this.shape, ((Shape) obj).shape)) { in equals()
101 if (shape == null) { in toString()
104 return Arrays.toString(shape).replace("-1", "?"); in toString()
[all …]
/external/tflite-support/tensorflow_lite_support/java/src/java/org/tensorflow/lite/support/image/
DColorSpaceType.java44 int[] getNormalizedShape(int[] shape) { in getNormalizedShape() argument
45 switch (shape.length) { in getNormalizedShape()
48 return insertValue(shape, BATCH_DIM, BATCH_VALUE); in getNormalizedShape()
50 return shape; in getNormalizedShape()
53 getShapeInfoMessage() + "The provided image shape is " + Arrays.toString(shape)); in getNormalizedShape()
86 int[] getNormalizedShape(int[] shape) { in getNormalizedShape() argument
87 switch (shape.length) { in getNormalizedShape()
90 int[] shapeWithBatch = insertValue(shape, BATCH_DIM, BATCH_VALUE); in getNormalizedShape()
93 return shape; in getNormalizedShape()
100 getShapeInfoMessage() + "The provided image shape is " + Arrays.toString(shape)); in getNormalizedShape()
[all …]
/external/ruy/ruy/
Dbenchmark.cc40 const BenchmarkShape& shape) { in Benchmark() argument
42 test_set.rows = shape.rows; in Benchmark()
43 test_set.depth = shape.depth; in Benchmark()
44 test_set.cols = shape.cols; in Benchmark()
72 const int asymmetry_lhs = shape.symm_lhs ? 0 : 1; in Benchmark()
73 const int asymmetry_rhs = shape.symm_rhs ? 0 : 1; in Benchmark()
136 BenchmarkShape shape; in Benchmark() local
139 shape.rows = explicit_rows ? explicit_rows : i; in Benchmark()
140 shape.cols = explicit_cols ? explicit_cols : i; in Benchmark()
141 shape.depth = explicit_depth ? explicit_depth : i; in Benchmark()
[all …]
/external/tensorflow/tensorflow/python/keras/engine/
Dinput_spec.py77 shape=None, argument
85 shape = tensor_shape.TensorShape(shape)
86 if shape.rank is None:
87 shape = None
89 shape = tuple(shape.as_list())
90 if shape is not None:
91 self.ndim = len(shape)
92 self.shape = shape
95 self.shape = None
115 ('shape=' + str(self.shape)) if self.shape else '',
[all …]
/external/tensorflow/tensorflow/compiler/xla/service/
Dbfloat16_propagation_test.cc77 if (inst->shape().element_type() == BF16) { in OutputsBF16()
82 inst->users()[0]->shape().element_type() == BF16; in OutputsBF16()
85 std::unique_ptr<HloInstruction> CreateDot(const Shape& shape, in CreateDot() argument
91 return HloInstruction::CreateDot(shape, lhs, rhs, dot_dnums, in CreateDot()
100 Shape shape = ShapeUtil::MakeShape(F32, {2, 4}); in TEST_F() local
103 builder.AddInstruction(HloInstruction::CreateParameter(0, shape, "a")); in TEST_F()
105 builder.AddInstruction(HloInstruction::CreateParameter(1, shape, "b")); in TEST_F()
107 builder.AddInstruction(HloInstruction::CreateParameter(2, shape, "c")); in TEST_F()
109 HloInstruction::CreateBinary(shape, HloOpcode::kAdd, a, b)); in TEST_F()
111 HloInstruction::CreateBinary(shape, HloOpcode::kAdd, add0, b)); in TEST_F()
[all …]
/external/tensorflow/tensorflow/python/keras/utils/
Dlosses_utils_test.py38 rank = x.shape.ndims
40 self.assertEqual(x_p.shape.ndims, rank)
50 self.assertEqual(x.shape.ndims, 3)
51 self.assertEqual(y.shape.ndims, 4)
53 y_p.shape.assert_is_compatible_with(x.shape)
54 self.assertEqual(y_p.shape.ndims, 3)
57 x_p.shape.assert_is_compatible_with(x.shape)
58 self.assertEqual(x_p.shape.ndims, 3)
64 y_p.shape.assert_is_compatible_with(x.shape)
65 self.assertEqual(y_p.shape.ndims, x.shape.ndims)
[all …]
/external/llvm-project/mlir/test/Analysis/
Dtest-shape-fn-report.mlir1 // RUN: mlir-opt %s --test-shape-function-report -verify-diagnostics
3 // expected-remark@+1 {{associated shape function: same_result_shape}}
5 attributes {shape.function = @shape_lib::@same_result_shape} {
8 // expected-remark@+1 {{associated shape function: same_result_shape}}
13 // The shape function library with some local functions.
14 shape.function_library @shape_lib {
15 // Test shape function that returns the shape of input arg as result shape.
16 func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape {
17 %0 = shape.shape_of %arg : !shape.value_shape -> !shape.shape
18 return %0 : !shape.shape

12345678910>>...218