MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / XLA_TEST_P

Function XLA_TEST_P

tensorflow/compiler/xla/tests/reshape_test.cc:54–67  ·  view source on GitHub ↗

Collapses 2-dimensional pseudo-scalar (single-element array) to 1 dimension.

Source from the content-addressed store, hash-verified

52
53// Collapses 2-dimensional pseudo-scalar (single-element array) to 1 dimension.
54XLA_TEST_P(ReshapeTest, CollapseTrivial1x1) {
55 XlaBuilder builder(TestName());
56 Array2D<float> input_array(1, 1);
57 input_array.Fill(1.0f);
58 auto input_literal = LiteralUtil::CreateR2FromArray2D(input_array);
59 XlaOp parameter;
60 auto input = CreateParameterAndTransferLiteral(0, input_literal, "parameter",
61 &builder, &parameter);
62 Collapse(/*operand=*/parameter, /*dimensions=*/{0, 1});
63
64 auto expected_literal = LiteralUtil::CreateR1<float>({1.0f});
65 ComputeAndCompareLiteral(&builder, expected_literal, {input.get()},
66 zero_error_spec_);
67}
68
69XLA_TEST_P(ReshapeTest, CollapseTrivialR1EmptyDims) {
70 XlaBuilder builder(TestName());

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
CollapseFunction · 0.85
MakeLinspaceArray2DFunction · 0.85
ArrayForDocR3TestsFunction · 0.85
MakeShapeFunction · 0.85
ConsumeValueOrDieMethod · 0.80
FillWithYXMethod · 0.80
RelayoutMethod · 0.80
ReshapeFunction · 0.50
NegFunction · 0.50
TransposeFunction · 0.50
HasSubstrFunction · 0.50

Tested by

no test coverage detected