18 tensorflow::OpKernelConstruction* construction)
19 : OpKernel(construction) {
20 using namespace tensorflow;
22 OP_REQUIRES_OK(construction,
23 construction->GetAttr(
"sample_size", &
sample_size));
25 absl::InvalidArgumentError(
26 "FurthestPointSampling expects positive npoint"));
30 using namespace tensorflow;
32 const Tensor& inp_tensor =
context->input(0);
35 inp_tensor.dims() == 3 && inp_tensor.shape().dim_size(2) == 3,
36 absl::InvalidArgumentError(
37 "FurthestPointSampling expects "
38 "(batch_size,num_points,3) inp shape"));
39 int batch_size = inp_tensor.shape().dim_size(0);
40 int pts_size = inp_tensor.shape().dim_size(1);
41 auto inp_flat = inp_tensor.flat<
float>();
42 const float* inp = &(inp_flat(0));
46 0, TensorShape{batch_size, sample_size},
48 auto out_flat = out_tensor->flat<
int>();
49 int* out = &(out_flat(0));
53 context->allocate_temp(DataTypeToEnum<float>::value,
54 TensorShape{batch_size, pts_size},
56 auto temp_flat = temp_tensor.flat<
float>();
57 float* temp = &(temp_flat(0));