Home
last modified time | relevance | path

Searched full:shape (Results 1 – 25 of 8218) sorted by relevance

12345678910>>...329

/external/tensorflow/tensorflow/compiler/xla/service/
Dshape_inference.h16 // Shape inference is used by the XLA service as the user builds up
33 // For a given operation and input shapes, infers what the resulting shape is
36 // the shape that results from an operation is inferred. Some methods have
37 // overloads for inferring shape at the HLO level.
39 // TODO(b/73352135): Shape inference does not issue very good error messages, in
40 // part because HloInstruction::ToString() is not available since shape
45 // Infers the shape produced by applying the given unary operation to the
46 // given input shape.
47 static StatusOr<Shape> InferUnaryOpShape(HloOpcode opcode,
48 const Shape& shape);
[all …]
/external/tensorflow/tensorflow/compiler/xla/
Dshape_util.h36 #include "tensorflow/compiler/xla/shape.h"
57 // An index for specifying a particular nested subshape within a shape. Used in
61 // shape. For a non-nested tuple, an index has a single element. For example,
89 // Namespaced collection of (static) shape utilities.
95 // Data structure which describes the coordinates and the shape, of a tuple
96 // shaped sub-shape.
99 IndexedShape(ShapeIndex index, Shape shape) in IndexedShape()
100 : index(std::move(index)), shape(std::move(shape)) {} in IndexedShape()
102 Shape shape; member
105 // Returns the number of elements are contained within the provided shape;
[all …]
Dshape_util.cc97 // Constructs and returns the new shape with the given minor_to_major order in
99 StatusOr<Shape> MakeShapeWithLayoutInternal( in MakeShapeWithLayoutInternal()
114 TF_ASSIGN_OR_RETURN(Shape shape, in MakeShapeWithLayoutInternal()
121 *shape.mutable_layout() = in MakeShapeWithLayoutInternal()
124 TF_RETURN_IF_ERROR(ShapeUtil::ValidateShape(shape)); in MakeShapeWithLayoutInternal()
125 return shape; in MakeShapeWithLayoutInternal()
140 Shape MakeTupleShapeImpl(absl::Span<ShapePtrOrRef> shapes) { in MakeTupleShapeImpl()
141 Shape result; in MakeTupleShapeImpl()
144 for (const auto& shape : shapes) { in MakeTupleShapeImpl() local
145 ShapeUtil::AppendShapeToTuple(Deref(shape), &result); in MakeTupleShapeImpl()
[all …]
Dlayout_util.cc118 /* static */ Layout LayoutUtil::GetDefaultLayoutForShape(const Shape& shape) { in GetDefaultLayoutForShape() argument
119 if (shape.IsOpaque() || shape.IsToken()) { in GetDefaultLayoutForShape()
125 CHECK(shape.IsArray()); in GetDefaultLayoutForShape()
126 return CreateDefaultLayoutForRank(shape.dimensions_size()); in GetDefaultLayoutForShape()
145 /* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) { in SetToDefaultLayout() argument
146 if (shape->IsTuple()) { in SetToDefaultLayout()
147 // Tuple shape. in SetToDefaultLayout()
148 for (auto& element_shape : *shape->mutable_tuple_shapes()) { in SetToDefaultLayout()
151 shape->clear_layout(); in SetToDefaultLayout()
152 } else if (shape->IsArray()) { in SetToDefaultLayout()
[all …]
Dlayout_util_test.cc29 Shape MakeShapeWithLayout( in MakeShapeWithLayout()
33 Shape shape = ShapeUtil::MakeShape(element_type, dimensions); local
34 *shape.mutable_layout() =
36 return shape;
41 Shape shape = in TEST_F() local
43 Shape other_shape = in TEST_F()
46 Shape tuple0 = ShapeUtil::MakeTupleShape({}); in TEST_F()
47 Shape tuple1 = ShapeUtil::MakeTupleShape({shape}); in TEST_F()
48 Shape tuple2 = ShapeUtil::MakeTupleShape({shape, shape}); in TEST_F()
60 Shape other_tuple2 = ShapeUtil::MakeTupleShape({shape, other_shape}); in TEST_F()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/tools/kernel_gen/tests/
Dshape_simplification.mlir1 // RUN: kernel-gen-opt -split-input-file -kernelgen-shape-simplification %s | FileCheck %s
5 func @f() -> !shape.shape {
6 // CHECK: shape.broadcast
7 %0 = shape.const_shape [2] : !shape.shape
8 %1 = shape.const_shape [7] : !shape.shape
9 %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape
10 return %2 : !shape.shape
15 // Broadcast of partially dynamic shapes yields a static shape.
17 func @f(%arg0 : tensor<42x?x42x?xf32>, %arg1 : tensor<42x?x?xf32>) -> !shape.shape {
18 // CHECK: %[[CST:.*]] = shape.const_shape [42, 42, 42, 256] : !shape.shape
[all …]
/external/tensorflow/tensorflow/compiler/xla/mlir_hlo/tests/
Dshape_simplification.mlir1 // RUN: mlir-hlo-opt -split-input-file -shape-simplification %s | FileCheck %s
5 func.func @f() -> !shape.shape {
6 // CHECK: shape.broadcast
7 %0 = shape.const_shape [2] : !shape.shape
8 %1 = shape.const_shape [7] : !shape.shape
9 %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape
10 func.return %2 : !shape.shape
15 // Broadcast of partially dynamic shapes yields a static shape.
17 func.func @f(%arg0 : tensor<42x?x42x?xf32>, %arg1 : tensor<42x?x?xf32>) -> !shape.shape {
18 // CHECK: %[[CST:.*]] = shape.const_shape [42, 42, 42, 256] : !shape.shape
[all …]
/external/tensorflow/tensorflow/lite/kernels/shim/
Dshape_test.cc15 #include "tensorflow/lite/kernels/shim/shape.h"
24 TEST(Shape, Eq) { in TEST() argument
25 EXPECT_TRUE(Shape({1, 2}) == Shape({1, 2})); in TEST()
27 EXPECT_TRUE(Shape(std::vector<int>{}) == Shape(std::vector<int>{})); in TEST()
29 EXPECT_TRUE(Shape({1}) == Shape({1})); in TEST()
31 EXPECT_FALSE(Shape({1, 2, 1}) == Shape({1, 2})); in TEST()
33 EXPECT_FALSE(Shape({1, 3}) == Shape({1, 2})); in TEST()
35 EXPECT_FALSE(Shape({3, -1, 2}) == Shape({3, -1, 2})); in TEST()
37 EXPECT_FALSE(Shape() == Shape()); in TEST()
38 // Unknown rank vs known shape in TEST()
[all …]
/external/gemmlowp/test/
Dbenchmark_meta_gemm.cc64 struct Shape { struct
73 Shape(std::int32_t n, std::int32_t m, std::int32_t k) in Shape() argument
104 double run_gemms(std::vector<Shape>* shapes) { in run_gemms() argument
106 for (auto& shape : *shapes) { in run_gemms()
107 ops += run_gemm(shape.n, shape.m, shape.k, shape.working_set().lhs, in run_gemms()
108 shape.working_set().rhs, shape.working_set().result); in run_gemms()
159 void time_all(std::vector<Shape>* shapes, std::int32_t repetitions, in time_all()
179 void time_one(Shape* shape, double max_time) { in time_one() argument
184 std::cout << std::setprecision(6) << std::fixed << shape->n << ", " in time_one()
185 << shape->m << ", " << shape->k << ", " << std::flush; in time_one()
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/common/
Dconvert.cc28 #include "tensorflow/lite/delegates/gpu/common/shape.h"
43 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()
[all …]
/external/tensorflow/tensorflow/compiler/xla/mlir_hlo/tests/Dialect/mhlo/
Dmerge_assuming_ops.mlir5 // Shape computations shall be reified.
9 // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG]] : tensor<?x32xi16> -> tensor<?xindex>
10 // CHECK: "use"(%[[SHAPE]])
12 %1 = shape.shape_of %0 : tensor<?x32xf16> -> tensor<?xindex>
19 // Shape computations shall be reified.
23 // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG0]] : tensor<?x32xf16> -> tensor<?xindex>
24 // CHECK: "use"(%[[SHAPE]])
27 %2 = shape.shape_of %1 : tensor<?x32xf16> -> tensor<?xindex>
37 %c : tensor<?xindex>) -> !shape.witness {
38 // CHECK-NOT: shape.broadcast
[all …]
Dconstraint_fusion.mlir9 // CHECK-DAG: %[[S0:.*]] = shape.shape_of %[[ARG0]]
10 // CHECK-DAG: %[[S1:.*]] = shape.shape_of %[[ARG1]]
11 // CHECK-DAG: %[[S2:.*]] = shape.shape_of %[[ARG2]]
12 // CHECK-DAG: %[[S3:.*]] = shape.shape_of %[[ARG3]]
13 // CHECK-DAG: %[[COMBINED_W:.*]] = shape.cstr_broadcastable %[[S0]], %[[S1]], %[[S2]], %[[S3]]
14 // CHECK: %[[RES:.*]] = shape.assuming %[[COMBINED_W]]
15 // CHECK-DAG: %[[S0_:.*]] = shape.shape_of %[[ARG0]]
16 // CHECK-DAG: %[[S1_:.*]] = shape.shape_of %[[ARG1]]
17 // CHECK-DAG: %[[S01:.*]] = shape.broadcast %[[S0_]], %[[S1_]]
21 // CHECK-DAG: %[[S2:.*]] = shape.shape_of %[[ARG2]]
[all …]
/external/armnn/src/armnn/test/
DTensorTest.cpp214 TensorShape shape({0,1,2,3}); variable
217 CHECK(shape[2] == 2);
218 shape[2] = 20;
219 CHECK(shape[2] == 20);
263 const armnn::TensorShape shape (armnn::Dimensionality::Scalar );
264 armnn::TensorInfo info ( shape, DataType::Float32 );
267 CHECK(armnn::Dimensionality::Scalar == shape.GetDimensionality());
273 shape_equal = shape;
274 CHECK(shape_equal == shape);
275 CHECK(shape_different != shape);
[all …]
/external/tensorflow/tensorflow/compiler/mlir/xla/ir/
Dmlir_hlo_builder.h32 #include "tensorflow/compiler/xla/shape.h"
108 // Returns the shape of the given op.
109 StatusOr<const Shape*> GetShapePtr(XlaOp op) const override;
121 const Shape& shape, XlaOp lhs, XlaOp rhs, const Window& window,
130 StatusOr<XlaOp> FftInternal(const Shape& shape, XlaOp operand,
135 const Shape& shape, XlaOp a, XlaOp b,
138 StatusOr<XlaOp> CholeskyInternal(const Shape& shape, XlaOp a,
143 const XlaComputation* computation, const Shape& shape,
145 std::optional<absl::Span<const Shape>> operand_shapes_with_layout,
154 const Shape& shape, absl::Span<const XlaOp> all_operands,
[all …]
/external/tensorflow/tensorflow/java/src/main/java/org/tensorflow/
DShape.java20 /** The possibly partially known shape of a tensor produced by an operation. */
21 public final class Shape { class
23 /** Create a Shape representing an unknown number of dimensions. */
24 public static Shape unknown() { in unknown()
25 return new Shape(null); in unknown()
28 /** Create a Shape representing a scalar value. */
29 public static Shape scalar() { in scalar()
30 return new Shape(new long[0]); in scalar()
34 * Create a Shape representing an N-dimensional value.
36 * <p>Creates a Shape representing an N-dimensional value (N being at least 1), with the provided
[all …]
/external/tensorflow/tensorflow/python/ops/
Dinit_ops_v2.py42 def __call__(self, shape, dtype=None, **kwargs):
43 # returns a tensor of shape `shape` and dtype `dtype`
48 def __call__(self, shape, dtype=None, **kwargs): argument
52 shape: Shape of the tensor.
57 partition in a partitioned variable. `partition_shape` is the shape of
58 the partition (i.e. the shape of the returned tensor) and
60 partition w.r.t each axis. For example, a tensor of shape `(30, 100)`
61 can be partitioned into two partitions: `p0` of shape `(10, 100)` and
62 `p1` of shape `(20, 100)`; if the initializer is called with
115 the Initializer object, without knowing the shape and dtype of the variable
[all …]
Dinit_ops_v2_test.py36 shape=None, argument
38 if shape is None:
39 shape = [100]
40 t1 = self.evaluate(init1(shape, dtype))
41 t2 = self.evaluate(init2(shape, dtype))
42 self.assertEqual(tensor_shape.as_shape(shape), t1.shape)
43 self.assertEqual(tensor_shape.as_shape(shape), t2.shape)
46 def _duplicated_test(self, init, shape=None, dtype=dtypes.float32): argument
47 if shape is None:
48 shape = [100]
[all …]
Drandom_ops.py43 def random_normal(shape, argument
55 <tf.Tensor: shape=(4,), dtype=float32, numpy=..., dtype=float32)>
61 <tf.Tensor: shape=(2, 2), dtype=float32, numpy=
70 shape: A 1-D integer Tensor or Python array. The shape of the output tensor.
84 A tensor of the specified shape filled with random normal values.
86 with ops.name_scope(name, "random_normal", [shape, mean, stddev]) as name:
87 shape_tensor = tensor_util.shape_tensor(shape)
95 tensor_util.maybe_set_static_shape(value, shape)
102 def parameterized_truncated_normal(shape, argument
117 shape: A 1-D integer Tensor or Python array. The shape of the output tensor.
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/common/task/
Dweights_conversion.h25 #include "tensorflow/lite/delegates/gpu/common/shape.h"
41 const int dst_slices = DivideRoundUp(weights.shape.o, 4); in RearrangeWeightsToOHWIOGroupI4O4()
42 const int src_slices = DivideRoundUp(weights.shape.i, 4); in RearrangeWeightsToOHWIOGroupI4O4()
47 for (int y = 0; y < weights.shape.h; ++y) { in RearrangeWeightsToOHWIOGroupI4O4()
48 for (int x = 0; x < weights.shape.w; ++x) { in RearrangeWeightsToOHWIOGroupI4O4()
56 if (s_ch < weights.shape.i && d_ch < weights.shape.o) { in RearrangeWeightsToOHWIOGroupI4O4()
58 weights.shape.LinearIndex({d_ch, y, x, s_ch}); in RearrangeWeightsToOHWIOGroupI4O4()
77 const int dst_slices = DivideRoundUp(weights.shape.o, 4); in RearrangeWeightsToODHWIOGroupI4O4()
78 const int src_slices = DivideRoundUp(weights.shape.i, 4); in RearrangeWeightsToODHWIOGroupI4O4()
83 for (int z = 0; z < weights.shape.d; ++z) { in RearrangeWeightsToODHWIOGroupI4O4()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/hlo/tests/
Dbroadcast_propagation.mlir3 // Shape computations shall be reified.
7 // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG]] : tensor<?x32xi16> -> tensor<?xindex>
8 // CHECK: "use"(%[[SHAPE]])
10 %1 = shape.shape_of %0 : tensor<?x32xf16> -> tensor<?xindex>
17 // Shape computations shall be reified.
21 // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG0]] : tensor<?x32xf16> -> tensor<?xindex>
22 // CHECK: "use"(%[[SHAPE]])
25 %2 = shape.shape_of %1 : tensor<?x32xf16> -> tensor<?xindex>
32 // Broadcasts can be moved up over unary shape-preserving operations.
49 // Broadcasts can be moved up over n-ary shape-preserving operations.
[all …]
/external/tensorflow/tensorflow/python/grappler/
Ddatasets_test.py15 """Tests for the datasets shape inference."""
35 'shape': tensor_shape.TensorShape([])
38 'shape': tensor_shape.TensorShape([3])
41 'shape': tensor_shape.TensorShape([1, 3])
54 self.assertEqual(test_case['shape'],
55 op_properties['IteratorGetNext'][0].shape)
60 'shape': tensor_shape.TensorShape([])
63 'shape': tensor_shape.TensorShape([3])
66 'shape': tensor_shape.TensorShape([1, 3])
79 self.assertEqual(test_case['shape'],
[all …]
/external/tensorflow/tensorflow/python/tpu/
Dtpu_sharding.py157 def get_unpartitioned_shape(self, shape): argument
158 """Returns the shape of an unpartitioned Tensor.
160 When given the shape of a 'sharded-size' Tensor, returns the shape
161 of the full shape of its unpartitioned Tensor.
164 shape: The shape of the sharded Tensor.
167 The shape of the unpartitioned version of the Tensor.
170 ValueError: if shape has unknown sharded dimension
172 shape = tensor_shape.as_shape(shape)
173 dims = shape.as_list()
178 raise ValueError(f"Shape {shape.as_list()} must have a fixed size for "
[all …]
/external/tensorflow/tensorflow/python/keras/engine/
Dinput_spec.py31 """Specifies the rank, dtype and shape of every input to a layer.
36 compatibility checks for input structure, input rank, input shape, and
39 A None entry in a shape is compatible with any dimension,
40 a None shape is compatible with any shape.
44 shape: Shape tuple, expected shape of the input
63 # The layer will accept inputs with shape (?, 28, 28) & (?, 28, 28, 1)
66 shape=(None, 28, 28, 1),
73 shape=None, argument
81 shape = tensor_shape.TensorShape(shape)
82 if shape.rank is None:
[all …]
/external/tflite-support/tensorflow_lite_support/java/src/java/org/tensorflow/lite/support/tensorbuffer/
DTensorBuffer.java33 /** Shape of the tensor stored in this buffer. */
34 protected int[] shape; field in TensorBuffer
46 * Creates a {@link TensorBuffer} with specified {@code shape} and {@link DataType}. Here are some
50 * Creating a float TensorBuffer with shape {2, 3}:
51 * int[] shape = new int[] {2, 3};
52 * TensorBuffer tensorBuffer = TensorBuffer.createFixedSize(shape, DataType.FLOAT32);
57 * int[] shape = new int[] {};
58 * TensorBuffer tensorBuffer = TensorBuffer.createFixedSize(shape, DataType.UINT8);
63 * int[] shape = new int[] {0};
64 * TensorBuffer tensorBuffer = TensorBuffer.createFixedSize(shape, DataType.UINT8);
[all …]
/external/tensorflow/tensorflow/cc/gradients/
Darray_grad_test.cc59 xs.push_back(Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape))); in TEST_F()
60 xs.push_back(Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape))); in TEST_F()
69 xs.push_back(Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape))); in TEST_F()
70 xs.push_back(Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape))); in TEST_F()
78 auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape)); in TEST_F()
87 auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape)); in TEST_F()
95 TensorShape shape({5, 2}); in TEST_F() local
96 auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape)); in TEST_F()
98 RunTest(x, shape, y, shape); in TEST_F()
103 auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape)); in TEST_F()
[all …]

12345678910>>...329