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

Method Compute

tensorflow/core/kernels/list_kernels.cc:236–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234 }
235
236 void Compute(OpKernelContext* ctx) override {
237 const Tensor& max_num_elements_t = ctx->input(1);
238 OP_REQUIRES(
239 ctx, TensorShapeUtils::IsScalar(max_num_elements_t.shape()),
240 errors::InvalidArgument(
241 "max_num_elements expected to be a scalar ",
242 "but got shape: ", max_num_elements_t.shape().DebugString()));
243 Tensor* result;
244 AllocatorAttributes attr;
245 attr.set_on_host(true);
246 OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape{}, &result, attr));
247 TensorList empty;
248 empty.element_dtype = element_dtype_;
249 empty.max_num_elements = max_num_elements_t.scalar<int32>()();
250 PartialTensorShape element_shape;
251 OP_REQUIRES_OK(ctx, TensorShapeFromTensor(ctx->input(0), &element_shape));
252 empty.element_shape = element_shape;
253 result->scalar<Variant>()() = std::move(empty);
254 }
255
256 private:
257 DataType element_dtype_;

Callers

nothing calls this directly

Calls 8

InvalidArgumentFunction · 0.85
TensorShapeFromTensorFunction · 0.85
set_on_hostMethod · 0.80
allocate_outputMethod · 0.80
IsScalarFunction · 0.50
inputMethod · 0.45
shapeMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected