const R2Spec& spec = GetParam();
Array2D<int32> input(spec.input_dim0, spec.input_dim1);
input.FillUnique();
+ auto literal = Literal::CreateR2FromArray2DWithLayout(
+ input, LayoutUtil::MakeLayout(spec.layout));
XlaBuilder builder(TestName());
- auto a = builder.ConstantR2FromArray2DWithLayout<int32>(
- input, LayoutUtil::MakeLayout(spec.layout));
+ auto a = builder.Parameter(0, literal->shape(), "p0");
builder.Slice(a, spec.slice_starts, spec.slice_limits, spec.slice_strides);
+ TF_ASSERT_OK_AND_ASSIGN(std::unique_ptr<GlobalData> arg,
+ client_->TransferToServer(*literal));
std::unique_ptr<Array2D<int32>> expected = ReferenceUtil::Slice2D(
input, spec.slice_starts, spec.slice_limits, spec.slice_strides);
- ComputeAndCompareR2<int32>(&builder, *expected, {});
+ ComputeAndCompareR2<int32>(&builder, *expected, {arg.get()});
}
INSTANTIATE_TEST_CASE_P(
void Run(const R4Spec& spec) {
Array4D<float> values(spec.input_dims[0], spec.input_dims[1],
spec.input_dims[2], spec.input_dims[3]);
- values.FillRandom(3.14f);
+ values.FillIota(3.14159);
auto expected = ReferenceUtil::Slice4D(
values, spec.slice_starts, spec.slice_limits, spec.slice_strides);
XlaBuilder builder(TestName());