29 using namespace tensorflow;
30 const Tensor& coords =
context->input(0);
32 coords.dims() == 3 && coords.shape().dim_size(1) == 3,
33 absl::InvalidArgumentError(
34 "TrilinearDevoxelize expects "
35 "(batch_size, 3, N) coordinate shape"));
36 const Tensor& feat =
context->input(1);
37 OP_REQUIRES(
context, feat.dims() == 5,
38 absl::InvalidArgumentError(
"TrilinearDevoxelize expects "
39 "5 dimensions for features"));
41 int batch_size = coords.shape().dim_size(0);
42 int num_points = coords.shape().dim_size(2);
43 int feat_dim = feat.shape().dim_size(1);
45 auto coords_flat = coords.flat<
float>();
46 auto feat_flat = feat.flat<
float>();
48 const float* inp_coords = &(coords_flat(0));
49 const float* inp_feat = &(feat_flat(0));
54 0, TensorShape{batch_size, feat_dim, num_points},
59 1, TensorShape{batch_size, 8, num_points},
64 2, TensorShape{batch_size, 8, num_points},
66 auto flat_0 = out_tensor_0->flat<
float>();
67 auto flat_1 = out_tensor_1->flat<
int>();
68 auto flat_2 = out_tensor_2->flat<
float>();
70 float* out_0 = &(flat_0(0));
71 int* out_1 = &(flat_1(0));
72 float* out_2 = &(flat_2(0));
76 r *
r *
r,
true, inp_coords, inp_feat, out_1, out_2, out_0);
79 r *
r *
r,
false, inp_coords, inp_feat, out_1, out_2, out_0);