Home
last modified time | relevance | path

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

12345678910>>...112

/external/tensorflow/tensorflow/compiler/xla/
Dshape_util.cc130 Shape shape = ShapeUtil::MakeShape(element_type, dimensions); in MakeShapeWithLayoutInternal() local
131 auto min2maj = shape.mutable_layout()->mutable_minor_to_major(); in MakeShapeWithLayoutInternal()
136 if (!shape.has_layout()) { in MakeShapeWithLayoutInternal()
139 TF_RETURN_IF_ERROR(ShapeUtil::ValidateShape(shape)); in MakeShapeWithLayoutInternal()
140 return shape; in MakeShapeWithLayoutInternal()
155 /* static */ int64 ShapeUtil::Rank(const Shape& shape) { in Rank() argument
156 CHECK(!ShapeUtil::IsTuple(shape)) in Rank()
157 << "Tuples do not have a rank, shape: " << shape; in Rank()
158 return shape.dimensions_size(); in Rank()
161 /* static */ int64 ShapeUtil::TrueRank(const Shape& shape) { in TrueRank() argument
[all …]
Dlayout_util.cc89 /* static */ Layout LayoutUtil::GetDefaultLayoutForShape(const Shape& shape) { in GetDefaultLayoutForShape() argument
91 DCHECK(!ShapeUtil::IsTuple(shape)); in GetDefaultLayoutForShape()
92 return CreateDefaultLayoutForRank(shape.dimensions_size()); in GetDefaultLayoutForShape()
111 /* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) { in SetToDefaultLayout() argument
112 if (ShapeUtil::IsTuple(*shape)) { in SetToDefaultLayout()
114 for (auto& element_shape : *shape->mutable_tuple_shapes()) { in SetToDefaultLayout()
117 shape->clear_layout(); in SetToDefaultLayout()
118 } else if (ShapeUtil::IsOpaque(*shape)) { in SetToDefaultLayout()
119 shape->clear_layout(); in SetToDefaultLayout()
121 shape->mutable_layout()->set_format(DENSE); in SetToDefaultLayout()
[all …]
Dshape_util.h155 static int64 ElementsIn(const Shape& shape);
158 static bool HasZeroElements(const Shape& shape);
167 static int64 ByteSizeOf(const Shape& shape, int64 pointer_size = -1);
177 static int64 ByteSizeOfTupleIndexTable(const Shape& shape,
188 static int64 ByteSizeOfElements(const Shape& shape);
193 static int64 ByteSizeOfSparseIndices(const Shape& shape);
197 static string HumanString(const Shape& shape);
198 static string HumanStringWithLayout(const Shape& shape);
262 static int64 Rank(const Shape& shape);
268 static int64 TrueRank(const Shape& shape);
[all …]
Dindex_util.cc30 const Shape& shape, tensorflow::gtl::ArraySlice<int64> multi_index) { in MultidimensionalIndexToLinearIndex() argument
31 DCHECK_EQ(shape.dimensions_size(), multi_index.size()); in MultidimensionalIndexToLinearIndex()
33 DCHECK_EQ(0, shape.layout().padded_dimensions_size()); in MultidimensionalIndexToLinearIndex()
37 DCHECK_LT(multi_index[i], shape.dimensions(i)) in MultidimensionalIndexToLinearIndex()
40 << "\n\tshape: " << ShapeUtil::HumanString(shape); in MultidimensionalIndexToLinearIndex()
81 for (auto dimension : LayoutUtil::MinorToMajor(shape)) { in MultidimensionalIndexToLinearIndex()
85 scale = shape.dimensions(dimension); in MultidimensionalIndexToLinearIndex()
89 scale *= shape.dimensions(dimension); in MultidimensionalIndexToLinearIndex()
96 const Shape& shape, int64 linear_index) { in LinearIndexToMultidimensionalIndex() argument
98 DCHECK_EQ(0, shape.layout().padded_dimensions_size()); in LinearIndexToMultidimensionalIndex()
[all …]
/external/tensorflow/tensorflow/compiler/xla/service/
Dimplicit_broadcast_remover_test.cc36 const Shape shape = ShapeUtil::MakeShape(F32, {2, 4}); in TEST_F() local
38 builder.AddInstruction(HloInstruction::CreateParameter(0, shape, "p0")); in TEST_F()
40 builder.AddInstruction(HloInstruction::CreateParameter(1, shape, "p1")); in TEST_F()
42 HloInstruction::CreateBinary(shape, HloOpcode::kAdd, param0, param1)); in TEST_F()
55 const Shape shape = ShapeUtil::MakeShape(F32, {2, 4}); in TEST_F() local
59 builder.AddInstruction(HloInstruction::CreateParameter(1, shape, "p1")); in TEST_F()
61 HloInstruction::CreateBinary(shape, HloOpcode::kPower, param0, param1)); in TEST_F()
66 EXPECT_FALSE(ShapeUtil::Compatible(root->shape(), root->operand(0)->shape())); in TEST_F()
67 EXPECT_TRUE(ShapeUtil::Compatible(root->shape(), root->operand(1)->shape())); in TEST_F()
74 EXPECT_TRUE(ShapeUtil::Compatible(root->shape(), root->operand(0)->shape())); in TEST_F()
[all …]
Dalgebraic_simplifier.cc70 return ShapeUtil::TransposeIsBitcast(operand->shape(), transpose->shape(), in TransposeIsBitcast()
87 return ShapeUtil::ReshapeIsBitcast(operand->shape(), reshape->shape()) && in ReshapeIsBitcast()
88 valid_bitcast_callback(operand->shape(), reshape->shape()); in ReshapeIsBitcast()
203 if (ShapeUtil::Rank(hlo->shape()) == 1) { in Flatten()
207 ShapeUtil::MakeShape(hlo->shape().element_type(), in Flatten()
208 {ShapeUtil::ElementsIn(hlo->shape())}), in Flatten()
218 Shape shape = ShapeUtil::DeleteDimension(dim, hlo->shape()); in AddReduce() local
220 shape, hlo, zero, {dim}, AddReduce_computation)); in AddReduce()
321 return ShapeUtil::Equal(lhs->shape(), rhs->shape()); in SameShape()
323 return ShapeUtil::Compatible(lhs->shape(), rhs->shape()); in SameShape()
[all …]
/external/tensorflow/tensorflow/contrib/seq2seq/python/kernel_tests/
Dattention_wrapper_test.py63 return ResultSummary(x.shape, x.dtype, x.mean())
96 state = cell.zero_state(array_ops.shape(memory)[0], dtypes.float32)
101 self.assertEqual(state.cell_state.c.shape, static_state.cell_state.c.shape)
102 self.assertEqual(state.cell_state.h.shape, static_state.cell_state.h.shape)
103 self.assertEqual(state.attention.shape, static_state.attention.shape)
157 shape=(None, None, input_depth))
161 shape=(None, None, encoder_output_depth))
265 shape=(5, 3, 6), dtype=dtype('float32'), mean=-0.0052250605),
267 shape=(5, 3), dtype=dtype('int32'), mean=1.4))
271 shape=(5, 9), dtype=dtype('float32'), mean=-0.0040092287),
[all …]
/external/tensorflow/tensorflow/contrib/distributions/python/ops/bijectors/
Dsoftmax_centered.py102 ndims = array_ops.shape(input_shape)
124 ndims = array_ops.shape(output_shape)[0]
141 if x.shape.ndims is not None:
142 shape = x.shape.as_list()
144 shape += [2]
145 elif shape[-1] is not None:
146 shape[-1] += 1
147 shape = tensor_shape.TensorShape(shape)
148 y.shape.assert_is_compatible_with(shape)
149 y.set_shape(shape)
[all …]
Dreshape.py39 def _static_ndims_from_shape(shape): argument
40 return shape.shape.with_rank_at_least(1)[0].value
43 def _ndims_from_shape(shape): argument
44 return array_ops.shape(shape)[0]
135 def _maybe_check_valid_shape(self, shape, validate_args): argument
137 if not shape.dtype.is_integer:
139 shape.op.name, shape.dtype.name))
143 ndims = array_ops.rank(shape)
147 shape.op.name, ndims_))
150 ndims, 1, message="`{}` rank should be <= 1.".format(shape.op.name)))
[all …]
/external/annotation-tools/annotation-file-utilities/figures/
Dtypecast.dot4 TypeCast [shape=box,width=1.25]
5 AnnotatedType [shape=box]
6 Annotation [shape=box]
7 Ident [shape=box]
8 PrimitiveTypeTree [shape=box]
9 e1 [shape=plaintext,label="",width=0.0]
10 e2 [shape=plaintext,label="",width=0.0]
11 e3 [shape=plaintext,label="",width=0.0]
12 b1 [shape=plaintext,label="_",width=0.0]
13 b2 [shape=plaintext,label="_",width=0.0]
[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/python/ops/
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[axis].value) * element_size
145 axis_shards = int(math.ceil(1.0 * shape[axis].value / slices_per_shard))
180 def _partitioner(shape, dtype): argument
201 if axis >= len(shape):
[all …]
Drandom_ops.py37 def _ShapeTensor(shape): argument
39 if isinstance(shape, (tuple, list)) and not shape:
43 return ops.convert_to_tensor(shape, dtype=dtype, name="shape")
48 def random_normal(shape, argument
72 with ops.name_scope(name, "random_normal", [shape, mean, stddev]) as name:
73 shape_tensor = _ShapeTensor(shape)
87 def parameterized_truncated_normal(shape, argument
122 [shape, means, stddevs, minvals, maxvals]) as name:
123 shape_tensor = _ShapeTensor(shape)
141 def truncated_normal(shape, argument
[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)
132 INNER_DIMS_1D, np.real, lambda x: np.fft.rfft(x, n=x.shape[-1]),
133 lambda x: spectral_ops.rfft(x, fft_length=[x.shape[-1].value]))
[all …]
/external/tensorflow/tensorflow/python/kernel_tests/
Dbias_op_test.py49 assert len(bias.shape) == 1
50 print(inputs.shape)
51 print(bias.shape)
52 assert inputs.shape[-1] == bias.shape[0]
53 return inputs + bias.reshape(([1] * (len(inputs.shape) - 1)) +
54 [bias.shape[0]])
71 return np.reshape(np_value, (1,) * (3 - np_value.ndim) + np_value.shape)
83 assert len(np_value.shape) >= 3
112 [1, 2], shape=[1, 2]),
114 [1, 2], shape=[1, 2]))
[all …]
Dinit_ops_test.py39 def identicaltest(tc, init1, init2, shape=None): argument
51 if shape is None:
52 shape = [100]
54 t1 = init1(shape).eval()
56 t2 = init2(shape).eval()
60 def duplicated_initializer(tc, init, graph_seed, shape=None): argument
77 if shape is None:
78 shape = [100]
81 t1 = init(shape).eval()
82 t2 = init(shape).eval()
[all …]
Dscatter_nd_ops_test.py41 shape = list(tensor.shape)
43 functools.reduce(lambda x, y: x * y, shape[:-ndims + 1], 1)
44 ] + shape[-ndims + 1:])
48 shape = list(tensor.shape)
49 return tensor.reshape(shape[:ndims - 1] + [
50 functools.reduce(lambda x, y: x * y, shape[ndims - 1:], 1)
55 ixdim = indices.shape[-1]
57 total_nd = len(ref.shape)
60 slice_size *= ref.shape[i]
68 return output_flat.reshape(ref.shape)
[all …]
Dunstack_op_test.py32 axis_len = array.shape[axis]
45 for shape in (2,), (3,), (2, 3), (3, 2), (4, 3, 2):
49 data = np.random.randn(*shape).astype(dtype)
53 cs = array_ops.unstack(x, num=shape[0])
55 self.assertEqual(len(cs), shape[0])
64 for shape in (2,), (3,), (2, 3), (3, 2), (4, 3, 2):
66 data = np.random.randn(*shape).astype(dtype)
70 cs = array_ops.unstack(x, num=shape[0])
72 self.assertEqual(len(cs), shape[0])
77 for shape in (2,), (3,), (2, 3), (3, 2), (4, 3, 2):
[all …]
/external/tensorflow/tensorflow/core/kernels/
Dsave_v2_op_test.cc132 TensorShape shape; in TEST_F() local
133 TF_EXPECT_OK(reader.LookupTensorShape("tensor_bool", &shape)); in TEST_F()
135 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
148 TensorShape shape; in TEST_F() local
149 TF_EXPECT_OK(reader.LookupTensorShape("tensor_int", &shape)); in TEST_F()
151 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
164 TensorShape shape; in TEST_F() local
165 TF_EXPECT_OK(reader.LookupTensorShape("tensor_float", &shape)); in TEST_F()
167 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
180 TensorShape shape; in TEST_F() local
[all …]
Dsave_op_test.cc138 TensorShape shape; in TEST_F() local
140 EXPECT_TRUE(reader.HasTensor("tensor_bool", &shape, &type)); in TEST_F()
142 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
157 TensorShape shape; in TEST_F() local
159 EXPECT_TRUE(reader.HasTensor("tensor_int", &shape, &type)); in TEST_F()
161 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
176 TensorShape shape; in TEST_F() local
178 EXPECT_TRUE(reader.HasTensor("tensor_float", &shape, &type)); in TEST_F()
180 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
195 TensorShape shape; in TEST_F() local
[all …]
Dtraining_ops.cc417 OP_REQUIRES(ctx, IsLegacyScalar(alpha.shape()), in Compute()
419 alpha.shape().DebugString())); in Compute()
422 ctx, var.shape().IsSameSize(delta.shape()), in Compute()
424 var.shape().DebugString(), " ", in Compute()
425 delta.shape().DebugString())); in Compute()
458 OP_REQUIRES(ctx, IsLegacyScalar(alpha_dev.shape()), in Compute()
460 alpha_dev.shape().DebugString())); in Compute()
463 ctx, var.shape().IsSameSize(delta.shape()), in Compute()
465 var.shape().DebugString(), " ", in Compute()
466 delta.shape().DebugString())); in Compute()
[all …]
/external/tensorflow/tensorflow/cc/framework/
Dgradient_checker_test.cc41 TensorShape shape({2, 4, 3}); in TEST() local
42 auto x = Placeholder(scope, DT_FLOAT, Placeholder::Shape(shape)); in TEST()
46 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
52 TensorShape shape({2, 4, 3}); in TEST() local
53 auto x = Placeholder(scope, DT_DOUBLE, Placeholder::Shape(shape)); in TEST()
57 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
63 TensorShape shape({2, 4, 3}); in TEST() local
64 auto x = Placeholder(scope, DT_COMPLEX64, Placeholder::Shape(shape)); in TEST()
68 scope, {x}, {shape}, {y}, {shape}, &max_error))); in TEST()
74 TensorShape shape({2, 4, 3}); in TEST() local
[all …]
/external/python/cpython3/Lib/test/
Dtest_buffer.py255 def strides_from_shape(ndim, shape, itemsize, layout): argument
261 strides = list(shape[1:]) + [itemsize]
265 strides = [itemsize] + list(shape[:-1])
297 def carray(items, shape): argument
298 if listp(items) and not 0 in shape and prod(shape) != len(items):
300 return _ca(items, shape)
302 def farray(items, shape): argument
303 if listp(items) and not 0 in shape and prod(shape) != len(items):
305 return _fa(items, shape)
307 def indices(shape): argument
[all …]
/external/tensorflow/tensorflow/python/keras/_impl/keras/applications/
Dimagenet_utils_test.py33 self.assertEqual(preprocess_input(x).shape, x.shape)
40 self.assertEqual(preprocess_input(x).shape, x.shape)
48 inputs = keras.layers.Input(shape=x.shape[1:])
50 preprocess_input, output_shape=x.shape[1:])(inputs)
52 assert model.predict(x).shape == x.shape
56 output_shape=x.shape[1:])(inputs)
60 inputs2 = keras.layers.Input(shape=x2.shape[1:])
64 output_shape=x2.shape[1:])(inputs2)
71 inputs = keras.layers.Input(shape=x.shape)
73 output_shape=x.shape)(inputs)
[all …]
/external/gemmlowp/test/
Dbenchmark_all_sizes.cc223 float benchmark(const Shape& shape) { in benchmark() argument
234 shape.rows, shape.depth, shape.cols); in benchmark()
240 shape.rows, shape.depth, shape.cols); in benchmark()
245 shape.rows, shape.depth, shape.cols); in benchmark()
250 shape.rows, shape.depth, shape.cols); in benchmark()
252 return benchmark_float(shape.rows, shape.depth, shape.cols); in benchmark()
282 Shape shape; in all_shapes_in_random_order() local
283 shape.rows = BENCHMARK_ROWS; in all_shapes_in_random_order()
284 shape.depth = BENCHMARK_DEPTH; in all_shapes_in_random_order()
285 shape.cols = BENCHMARK_COLS; in all_shapes_in_random_order()
[all …]

12345678910>>...112