Home
last modified time | relevance | path

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

12345678910>>...141

/external/tensorflow/tensorflow/compiler/xla/
Dshape_util.cc103 TF_ASSIGN_OR_RETURN(Shape shape, in MakeShapeWithLayoutInternal()
105 *shape.mutable_layout() = in MakeShapeWithLayoutInternal()
107 if (!shape.has_layout()) { in MakeShapeWithLayoutInternal()
110 TF_RETURN_IF_ERROR(ShapeUtil::ValidateShape(shape)); in MakeShapeWithLayoutInternal()
111 return shape; in MakeShapeWithLayoutInternal()
137 /* static */ int64 ShapeUtil::TrueRank(const Shape& shape) { in TrueRank() argument
139 for (int64 dimension : shape.dimensions()) { in TrueRank()
151 for (const Shape& shape : parameters) { in MakeProgramShape() local
152 *program_shape.add_parameters() = shape; in MakeProgramShape()
181 TF_ASSIGN_OR_RETURN(Shape shape, in MakeValidatedShape()
[all …]
Dshape_util.h177 IndexedShape(ShapeIndex index, Shape shape) in IndexedShape()
178 : index(std::move(index)), shape(std::move(shape)) {} in IndexedShape()
180 Shape shape; member
189 static int64 ElementsIn(const Shape& shape);
192 static int64 ElementsInRecursive(const Shape& shape);
195 static bool HasPrimitiveType(const Shape& shape,
199 static bool IsZeroElementArray(const Shape& shape);
206 static int64 ByteSizeOf(const Shape& shape, int64 pointer_size = -1);
216 static int64 ByteSizeOfTupleIndexTable(const Shape& shape,
227 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()
40 Shape shape = ShapeUtil::MakeShape(element_type, dimensions); in MakeShapeWithSparseLayout() local
41 *shape.mutable_layout() = LayoutUtil::MakeSparseLayout(max_sparse_elements); in MakeShapeWithSparseLayout()
42 return shape; in MakeShapeWithSparseLayout()
47 Shape shape = in TEST_F() local
53 Shape tuple1 = ShapeUtil::MakeTupleShape({shape}); in TEST_F()
54 Shape tuple2 = ShapeUtil::MakeTupleShape({shape, shape}); in TEST_F()
66 Shape other_tuple2 = ShapeUtil::MakeTupleShape({shape, other_shape}); in TEST_F()
[all …]
Dlayout_util.cc115 /* static */ Layout LayoutUtil::GetDefaultLayoutForShape(const Shape& shape) { in GetDefaultLayoutForShape() argument
116 if (shape.IsOpaque() || shape.IsToken()) { in GetDefaultLayoutForShape()
122 CHECK(shape.IsArray()); in GetDefaultLayoutForShape()
123 return CreateDefaultLayoutForRank(shape.dimensions_size()); in GetDefaultLayoutForShape()
142 /* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) { in SetToDefaultLayout() argument
143 if (shape->IsTuple()) { in SetToDefaultLayout()
145 for (auto& element_shape : *shape->mutable_tuple_shapes()) { in SetToDefaultLayout()
148 shape->clear_layout(); in SetToDefaultLayout()
149 } else if (shape->IsArray()) { in SetToDefaultLayout()
150 shape->mutable_layout()->set_format(DENSE); in SetToDefaultLayout()
[all …]
Dindex_util.cc29 const Shape& shape, absl::Span<const int64> multi_index) { in MultidimensionalIndexToLinearIndex() argument
30 DCHECK_EQ(shape.dimensions_size(), multi_index.size()); in MultidimensionalIndexToLinearIndex()
34 DCHECK_LT(multi_index[i], shape.dimensions(i)) in MultidimensionalIndexToLinearIndex()
37 << "\n\tshape: " << ShapeUtil::HumanString(shape); in MultidimensionalIndexToLinearIndex()
78 for (auto dimension : LayoutUtil::MinorToMajor(shape)) { in MultidimensionalIndexToLinearIndex()
82 scale = shape.dimensions(dimension); in MultidimensionalIndexToLinearIndex()
86 scale *= shape.dimensions(dimension); in MultidimensionalIndexToLinearIndex()
93 const Shape& shape, int64 linear_index) { in LinearIndexToMultidimensionalIndex() argument
95 DCHECK_LT(linear_index, ShapeUtil::ElementsIn(shape)); in LinearIndexToMultidimensionalIndex()
104 std::vector<int64> multi_index(shape.dimensions_size()); in LinearIndexToMultidimensionalIndex()
[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 …]
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 …]
Dinit_ops.py58 def __call__(self, shape, dtype=None, partition_info=None): argument
112 def __call__(self, shape, dtype=None, partition_info=None): argument
115 return array_ops.zeros(shape, dtype)
133 def __call__(self, shape, dtype=None, partition_info=None): argument
136 return array_ops.ones(shape, dtype)
241 def __call__(self, shape, dtype=None, partition_info=None, verify_shape=None): argument
247 self.value, dtype=dtype, shape=shape, verify_shape=verify_shape)
284 def __call__(self, shape, dtype=None, partition_info=None): argument
288 shape, self.minval, self.maxval, dtype, seed=self.seed)
326 def __call__(self, shape, dtype=None, partition_info=None): argument
[all …]
Dstateful_random_ops_test.py61 shape = [2, 3]
63 a = random.non_deterministic_ints(shape=shape, dtype=dtype)
64 self.assertAllEqual(shape, a.shape)
66 b = random.non_deterministic_ints(shape, dtype=dtype)
77 shape = [2, 3]
80 expected_normal1 = gen.normal(shape)
81 expected_normal2 = gen.normal(shape)
91 r = g_seeded.normal(shape)
92 r = (r, g_unseeded.normal(shape))
96 self.assertAllEqual(shape, v2.shape)
[all …]
Dstateful_random_ops.py64 def non_deterministic_ints(shape, dtype=dtypes.int64): argument
78 shape=shape, dtype=dtype)
108 if len(seed.shape) != 1:
110 "seed should only have one dimension; got shape: %s" % seed.shape)
113 seed_size = seed.shape[0]
119 assert seed.shape == (state_size,), "Wrong seed.shape: %s" % seed.shape
150 def _shape_tensor(shape): argument
152 if isinstance(shape, (tuple, list)) and not shape:
156 return ops.convert_to_tensor(shape, dtype=dtype, name="shape")
181 state = non_deterministic_ints(shape=[_get_state_size(algorithm)],
[all …]
Drandom_ops.py38 def _ShapeTensor(shape): argument
40 if isinstance(shape, (tuple, list)) and not shape:
44 return ops.convert_to_tensor(shape, dtype=dtype, name="shape")
49 def random_normal(shape, argument
73 with ops.name_scope(name, "random_normal", [shape, mean, stddev]) as name:
74 shape_tensor = _ShapeTensor(shape)
88 def parameterized_truncated_normal(shape, argument
123 [shape, means, stddevs, minvals, maxvals]) as name:
124 shape_tensor = _ShapeTensor(shape)
144 def truncated_normal(shape, argument
[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 …]
Dhlo_verifier.cc31 Status VerifyNotSparse(const Shape& shape) { in VerifyNotSparse() argument
33 shape, [](const Shape& subshape, const ShapeIndex&) -> Status { in VerifyNotSparse()
91 TF_RETURN_IF_ERROR(VerifyNotSparse(hlo->shape())); in Preprocess()
123 operand_shapes.push_back(&operand->shape()); in HandleConcatenate()
132 convert->operand(0)->shape(), in HandleConvert()
133 convert->shape().element_type())); in HandleConvert()
138 convert->operand(0)->shape(), in HandleBitcastConvert()
139 convert->shape().element_type())); in HandleBitcastConvert()
149 dot->operand(0)->shape(), dot->operand(1)->shape(), in HandleDot()
158 convolution->operand(0)->shape(), convolution->operand(1)->shape(), in HandleConvolution()
[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)
135 INNER_DIMS_1D, np.real, lambda x: np.fft.rfft(x, n=x.shape[-1]),
136 lambda x: signal.rfft(x, fft_length=[x.shape[-1].value]))
[all …]
/external/tensorflow/tensorflow/contrib/seq2seq/python/kernel_tests/
Dattention_wrapper_test.py64 return ResultSummary(x.shape, x.dtype, x.mean())
98 state = cell.zero_state(array_ops.shape(memory)[0], dtypes.float32)
103 self.assertEqual(state.cell_state.c.shape, static_state.cell_state.c.shape)
104 self.assertEqual(state.cell_state.h.shape, static_state.cell_state.h.shape)
105 self.assertEqual(state.attention.shape, static_state.attention.shape)
172 shape=(None, None, input_depth))
176 shape=(None, None, encoder_output_depth))
288 encoder_outputs = array_ops.placeholder(dtype, shape=[64, None, 256])
289 encoder_sequence_length = array_ops.placeholder(dtypes.int32, shape=[64])
290 decoder_inputs = array_ops.placeholder(dtype, shape=[64, None, 128])
[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/core/kernels/
Dsave_v2_op_test.cc131 TensorShape shape; in TEST_F() local
132 TF_EXPECT_OK(reader.LookupTensorShape("tensor_bool", &shape)); in TEST_F()
134 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
147 TensorShape shape; in TEST_F() local
148 TF_EXPECT_OK(reader.LookupTensorShape("tensor_int", &shape)); in TEST_F()
150 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
163 TensorShape shape; in TEST_F() local
164 TF_EXPECT_OK(reader.LookupTensorShape("tensor_float", &shape)); in TEST_F()
166 EXPECT_TRUE(shape.IsSameSize(expected)); in TEST_F()
179 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 …]
/external/python/cpython3/Lib/test/
Dtest_buffer.py256 def strides_from_shape(ndim, shape, itemsize, layout): argument
262 strides = list(shape[1:]) + [itemsize]
266 strides = [itemsize] + list(shape[:-1])
298 def carray(items, shape): argument
299 if listp(items) and not 0 in shape and prod(shape) != len(items):
301 return _ca(items, shape)
303 def farray(items, shape): argument
304 if listp(items) and not 0 in shape and prod(shape) != len(items):
306 return _fa(items, shape)
308 def indices(shape): argument
[all …]
/external/tensorflow/tensorflow/contrib/distributions/python/ops/bijectors/
Dreshape.py49 def _static_ndims_from_shape(shape): argument
50 return tensor_shape.dimension_value(shape.shape.with_rank_at_least(1)[0])
61 def _ndims_from_shape(shape): argument
62 return array_ops.shape(shape)[0]
164 def _maybe_check_valid_shape(self, shape, validate_args): argument
166 if not shape.dtype.is_integer:
168 shape, shape.dtype.name))
172 ndims = array_ops.rank(shape)
176 shape, ndims_))
179 ndims, 1, message="`{}` rank should be <= 1.".format(shape)))
[all …]
/external/tensorflow/tensorflow/python/keras/engine/
Dinput_spec.py52 shape=None, argument
58 self.shape = shape
59 if shape is not None:
60 self.ndim = len(shape)
69 ('shape=' + str(self.shape)) if self.shape else '',
110 if x.shape.ndims is None:
118 ndim = x.shape.ndims
124 str(x.shape.as_list()))
126 ndim = x.shape.ndims
133 ndim = x.shape.ndims
[all …]
/external/tensorflow/tensorflow/python/keras/layers/
Dmerge_test.py35 i1 = keras.layers.Input(shape=(4, 5))
36 i2 = keras.layers.Input(shape=(4, 5))
37 i3 = keras.layers.Input(shape=(4, 5))
41 self.assertListEqual(o.shape.as_list(), [None, 4, 5])
49 self.assertEqual(out.shape, (2, 4, 5))
68 i1 = keras.layers.Input(shape=(4, 5))
69 i2 = keras.layers.Input(shape=(4, 5))
70 i3 = keras.layers.Input(shape=(4, 5))
74 self.assertListEqual(o.shape.as_list(), [None, 4, 5])
81 self.assertEqual(out.shape, (2, 4, 5))
[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 …]

12345678910>>...141