Home
last modified time | relevance | path

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

12345678910>>...165

/external/tensorflow/tensorflow/lite/delegates/gpu/common/
Dconvert.cc33 Status ConvertToPHWO4I4(absl::Span<const float> in, const OHWI& shape, in ConvertToPHWO4I4() argument
35 if (in.size() != shape.DimensionsProduct()) { in ConvertToPHWO4I4()
38 in.size(), " != ", shape.DimensionsProduct())); in ConvertToPHWO4I4()
40 if (out.size() != GetElementsSizeForPHWO4I4(shape)) { in ConvertToPHWO4I4()
43 out.size(), " != ", GetElementsSizeForPHWO4I4(shape))); in ConvertToPHWO4I4()
47 for (int p = 0; p < IntegralDivideRoundUp(shape.o, kPhwo4i4ChannelsInPlane); in ConvertToPHWO4I4()
49 for (int h = 0; h < shape.h; ++h) { in ConvertToPHWO4I4()
50 for (int w = 0; w < shape.w; ++w) { in ConvertToPHWO4I4()
52 c < IntegralDivideRoundUp(shape.i, kPhwo4i4ChannelsInPlane); ++c) { in ConvertToPHWO4I4()
56 if (c * kPhwo4i4ChannelsInPlane + ci < shape.i && in ConvertToPHWO4I4()
[all …]
/external/tensorflow/tensorflow/compiler/xla/
Dshape_util.cc103 TF_ASSIGN_OR_RETURN(Shape shape, in MakeShapeWithLayoutInternal()
110 *shape.mutable_layout() = LayoutUtil::MakeLayout( in MakeShapeWithLayoutInternal()
112 if (!shape.has_layout()) { in MakeShapeWithLayoutInternal()
115 TF_RETURN_IF_ERROR(ShapeUtil::ValidateShape(shape)); in MakeShapeWithLayoutInternal()
116 return shape; in MakeShapeWithLayoutInternal()
153 /* static */ int64 ShapeUtil::TrueRank(const Shape& shape) { in TrueRank() argument
155 for (int64 dimension : shape.dimensions()) { in TrueRank()
167 for (const Shape& shape : parameters) { in MakeProgramShape() local
168 *program_shape.add_parameters() = shape; in MakeProgramShape()
191 const Shape& shape) { in MakeShapeWithStaticDimensions() argument
[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 …]
Dshape_util.h188 IndexedShape(ShapeIndex index, Shape shape) in IndexedShape()
189 : index(std::move(index)), shape(std::move(shape)) {} in IndexedShape()
191 Shape shape; member
197 static int64 ElementsIn(const Shape& shape);
200 static int64 ElementsInRecursive(const Shape& shape);
203 static bool HasPrimitiveType(const Shape& shape,
207 static bool IsZeroElementArray(const Shape& shape);
214 static int64 ByteSizeOf(const Shape& shape, int64 pointer_size = -1);
224 static int64 ByteSizeOfTupleIndexTable(const Shape& shape,
232 static int64 ByteSizeOfElements(const Shape& shape);
[all …]
Dlayout_util.cc111 /* static */ Layout LayoutUtil::GetDefaultLayoutForShape(const Shape& shape) { in GetDefaultLayoutForShape() argument
112 if (shape.IsOpaque() || shape.IsToken()) { in GetDefaultLayoutForShape()
118 CHECK(shape.IsArray()); in GetDefaultLayoutForShape()
119 return CreateDefaultLayoutForRank(shape.dimensions_size()); in GetDefaultLayoutForShape()
138 /* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) { in SetToDefaultLayout() argument
139 if (shape->IsTuple()) { in SetToDefaultLayout()
141 for (auto& element_shape : *shape->mutable_tuple_shapes()) { in SetToDefaultLayout()
144 shape->clear_layout(); in SetToDefaultLayout()
145 } else if (shape->IsArray()) { in SetToDefaultLayout()
146 shape->mutable_layout()->set_format(DENSE); in SetToDefaultLayout()
[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)
52 shape=None, argument
54 if shape is None:
55 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
148 def _check_state_shape(shape, alg): argument
151 shape.assert_is_compatible_with([_get_state_size(int(alg))])
210 def _shape_tensor(shape): argument
212 if isinstance(shape, (tuple, list)) and not shape:
[all …]
Drandom_ops.py44 def random_normal(shape, argument
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
137 [shape, means, stddevs, minvals, maxvals]) as name:
138 shape_tensor = tensor_util.shape_tensor(shape)
152 tensor_util.maybe_set_static_shape(rnd, shape)
159 def truncated_normal(shape, argument
187 with ops.name_scope(name, "truncated_normal", [shape, mean, stddev]) as name:
[all …]
Dpartitioned_variables.py111 def _partitioner(shape, dtype): argument
125 if not isinstance(shape, tensor_shape.TensorShape):
126 raise ValueError("shape is not a TensorShape: %s" % shape)
127 if not shape.is_fully_defined():
128 raise ValueError("shape is not fully defined: %s" % shape)
137 partitions = [1] * shape.ndims
139 shape.num_elements() / shape.dims[axis].value) * element_size
146 1.0 * shape.dims[axis].value / slices_per_shard))
181 def _partitioner(shape, dtype): argument
202 if axis >= len(shape):
[all …]
/external/tensorflow/tensorflow/lite/experimental/support/java/src/java/org/tensorflow/lite/support/tensorbuffer/
DTensorBuffer.java31 protected int[] shape; field in TensorBuffer
72 public static TensorBuffer createFixedSize(@NonNull int[] shape, DataType dataType) { in createFixedSize() argument
75 return new TensorBufferFloat(shape); in createFixedSize()
77 return new TensorBufferUint8(shape); in createFixedSize()
118 result = createFixedSize(buffer.shape, dataType); in createFrom()
125 result.loadArray(data, buffer.shape); in createFrom()
128 result.loadArray(data, buffer.shape); in createFrom()
147 return Arrays.copyOf(shape, shape.length); in getShape()
195 public abstract void loadArray(@NonNull int[] src, @NonNull int[] shape); in loadArray() argument
210 loadArray(src, shape); in loadArray()
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/gl/kernels/
Delementwise_test.cc31 TensorRef<BHWC> GetTensorRef(int ref, const BHWC& shape) { in GetTensorRef() argument
35 tensor_ref.shape = shape; in GetTensorRef()
41 const BHWC shape(1, 2, 2, 1); in TEST() local
43 /*inputs=*/{GetTensorRef(0, shape)}, in TEST()
44 /*outputs=*/{GetTensorRef(1, shape)}); in TEST()
53 const BHWC shape(1, 2, 2, 1); in TEST() local
55 /*inputs=*/{GetTensorRef(0, shape)}, in TEST()
56 /*outputs=*/{GetTensorRef(1, shape)}); in TEST()
65 const BHWC shape(1, 2, 2, 1); in TEST() local
68 /*inputs=*/{GetTensorRef(0, shape), GetTensorRef(1, shape)}, in TEST()
[all …]
Dprelu.cc47 if (alpha->shape.v != output->tensor.shape.c) { in GenerateCode()
52 auto shape = output->tensor.shape; in GenerateCode() local
74 uint3(shape.w, shape.h, IntegralDivideRoundUp(shape.c, 4)), in GenerateCode()
97 if (alpha->shape.h != output->tensor.shape.h || in GenerateCode()
98 alpha->shape.w != output->tensor.shape.w || in GenerateCode()
99 alpha->shape.c != output->tensor.shape.c) { in GenerateCode()
103 auto shape = output->tensor.shape; in GenerateCode() local
106 uint3(shape.w, shape.h, IntegralDivideRoundUp(shape.c, 4)); in GenerateCode()
119 uint3(shape.w, shape.h, IntegralDivideRoundUp(shape.c, 4)), in GenerateCode()
136 uint3(shape.w, shape.h, IntegralDivideRoundUp(shape.c, 4)), in GenerateCode()
/external/tensorflow/tensorflow/lite/delegates/gpu/cl/
Dtensor.cc55 const BHWDC& shape, const TensorDescriptor& descriptor, in CreateTensor() argument
61 AllocateTensorMemory(context, device, shape, descriptor, &mem)); in CreateTensor()
68 shape.b * shape.w * shape.h * shape.d * in CreateTensor()
69 IntegralDivideRoundUp(shape.c, 4), in CreateTensor()
71 *result = Tensor(memory, memory_owner, image_memory, shape, descriptor); in CreateTensor()
73 *result = Tensor(memory, memory_owner, shape, descriptor); in CreateTensor()
79 Tensor::Tensor(cl_mem memory, bool memory_owner, const BHWC& shape, in Tensor() argument
84 shape_(shape.b, shape.h, shape.w, 1, shape.c), in Tensor()
87 Tensor::Tensor(cl_mem memory, bool memory_owner, const BHWDC& shape, in Tensor() argument
92 shape_(shape), in Tensor()
[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/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 …]
Dmemory_space_assignment_test.cc34 int64 ShapeSize(const Shape& shape) { in ShapeSize() argument
35 return ShapeUtil::ByteSizeOf(shape, kPointerSize); in ShapeSize()
90 return ShapeUtil::ByteSizeOf(buffer.shape(), /*pointer_size=*/8); in AssignMemorySpace()
144 ShapeUtil::GetSubshape(position.instruction->shape(), position.index); in CheckPresetAssignments()
153 Shape shape = ShapeUtil::MakeShape(F32, {2, 3}); in CreateEvictAndPrefetchModule() local
155 builder.AddInstruction(HloInstruction::CreateParameter(0, shape, "p0")); in CreateEvictAndPrefetchModule()
157 builder.AddInstruction(HloInstruction::CreateParameter(1, shape, "p1")); in CreateEvictAndPrefetchModule()
159 HloInstruction::CreateUnary(shape, HloOpcode::kTanh, p0)); in CreateEvictAndPrefetchModule()
166 HloInstruction::CreateBinary(shape, HloOpcode::kAdd, p0, tanh)); in CreateEvictAndPrefetchModule()
168 HloInstruction::CreateBinary(shape, HloOpcode::kSubtract, p0, p1)); in CreateEvictAndPrefetchModule()
[all …]
/external/tensorflow/tensorflow/lite/experimental/ruy/
Dbenchmark.cc41 const BenchmarkShape& shape) { in BenchmarkRCC() argument
43 test_set.rows = shape.rows; in BenchmarkRCC()
44 test_set.depth = shape.depth; in BenchmarkRCC()
45 test_set.cols = shape.cols; in BenchmarkRCC()
51 const int asymmetry_lhs = shape.symm_lhs ? 0 : 1; in BenchmarkRCC()
52 const int asymmetry_rhs = shape.symm_rhs ? 0 : 1; in BenchmarkRCC()
109 BenchmarkShape shape; in Benchmark() local
112 shape.rows = explicit_rows ? explicit_rows : i; in Benchmark()
113 shape.cols = explicit_cols ? explicit_cols : i; in Benchmark()
114 shape.depth = explicit_depth ? explicit_depth : i; in Benchmark()
[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/tensorflow/tensorflow/cc/framework/
Dgradient_checker_test.cc43 TensorShape shape({2, 4, 3}); in TEST() local
44 auto x = Placeholder(scope, DT_FLOAT, Placeholder::Shape(shape)); in TEST()
48 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
54 TensorShape shape({2, 4, 3}); in TEST() local
55 auto x = Placeholder(scope, DT_DOUBLE, Placeholder::Shape(shape)); in TEST()
59 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
65 TensorShape shape({2, 4, 3}); in TEST() local
66 auto x = Placeholder(scope, DT_COMPLEX64, Placeholder::Shape(shape)); in TEST()
70 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
76 TensorShape shape({2, 4, 3}); in TEST() local
[all …]
/external/tensorflow/tensorflow/python/keras/engine/
Dinput_spec.py56 shape=None, argument
62 if shape is not None:
63 self.ndim = len(shape)
64 self.shape = shape
67 self.shape = None
85 ('shape=' + str(self.shape)) if self.shape else '',
95 'shape': self.shape,
118 if spec.ndim is None and spec.shape is None:
120 elif spec.shape is not None:
121 return tensor_shape.TensorShape(spec.shape)
[all …]
/external/tensorflow/tensorflow/core/kernels/
Dsave_v2_op_test.cc133 TensorShape shape; in TEST_F() local
134 TF_EXPECT_OK(reader.LookupTensorShape("tensor_bool", &shape)); in TEST_F()
136 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
149 TensorShape shape; in TEST_F() local
150 TF_EXPECT_OK(reader.LookupTensorShape("tensor_int", &shape)); in TEST_F()
152 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
165 TensorShape shape; in TEST_F() local
166 TF_EXPECT_OK(reader.LookupTensorShape("tensor_float", &shape)); in TEST_F()
168 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
181 TensorShape shape; in TEST_F() local
[all …]
/external/tensorflow/tensorflow/lite/experimental/swift/Tests/
DTensorTests.swift24 let shape = Tensor.Shape(Constant.dimensions) in testInit() variable
30 shape: shape, in testInit()
36 XCTAssertEqual(inputTensor.shape, shape) in testInit()
44 let shape = Tensor.Shape(Constant.dimensions) in testEquatable() variable
50 shape: shape, in testEquatable()
57 shape: shape, in testEquatable()
66 shape: shape, in testEquatable()
77 let shape = Tensor.Shape(Constant.dimensions) in testInitWithArray() variable
78 XCTAssertEqual(shape.rank, Constant.dimensions.count) in testInitWithArray()
79 XCTAssertEqual(shape.dimensions, Constant.dimensions) in testInitWithArray()
[all …]
/external/tensorflow/tensorflow/compiler/xla/client/lib/
Dtesting.cc36 int64 DataSizeOfShape(const Shape& shape) { in DataSizeOfShape() argument
37 if (shape.IsArray()) { in DataSizeOfShape()
38 return ShapeUtil::ByteSizeOf(shape); in DataSizeOfShape()
42 for (const Shape& s : shape.tuple_shapes()) { in DataSizeOfShape()
49 XlaOp BuildFakeDataOpOnDevice(const Shape& shape, XlaBuilder* builder) { in BuildFakeDataOpOnDevice() argument
50 if (shape.IsArray()) { in BuildFakeDataOpOnDevice()
52 ConstantLiteral(builder, LiteralUtil::One(shape.element_type())), in BuildFakeDataOpOnDevice()
53 AsInt64Slice(shape.dimensions())); in BuildFakeDataOpOnDevice()
56 for (const Shape& s : shape.tuple_shapes()) { in BuildFakeDataOpOnDevice()
63 const Shape& shape, Client* client, DebugOptions* debug_opts) { in MakeFakeDataViaDeviceOrDie() argument
[all …]
/external/tensorflow/tensorflow/python/keras/applications/
Dimagenet_utils_test.py35 self.assertEqual(utils.preprocess_input(x).shape, x.shape)
36 self.assertEqual(utils.preprocess_input(xint).shape, xint.shape)
50 self.assertEqual(utils.preprocess_input(x).shape, x.shape)
51 self.assertEqual(utils.preprocess_input(xint).shape, xint.shape)
81 inputs = keras.layers.Input(shape=x.shape[1:])
83 utils.preprocess_input, output_shape=x.shape[1:])(
86 self.assertEqual(model.predict(x).shape, x.shape)
90 output_shape=x.shape[1:])(
95 inputs2 = keras.layers.Input(shape=x2.shape[1:])
98 output_shape=x2.shape[1:])(
[all …]

12345678910>>...165