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

Method Compute

tensorflow/core/kernels/list_kernels.cc:404–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402 }
403
404 void Compute(OpKernelContext* c) override {
405 PartialTensorShape element_shape;
406 OP_REQUIRES_OK(c, TensorShapeFromTensor(c->input(0), &element_shape));
407 int32 num_elements = c->input(1).scalar<int32>()();
408 OP_REQUIRES(c, num_elements >= 0,
409 errors::InvalidArgument("The num_elements to reserve must be a "
410 "non negative number, but got ",
411 num_elements));
412 TensorList output;
413 output.element_shape = element_shape;
414 output.element_dtype = element_dtype_;
415 output.tensors().resize(num_elements, Tensor(DT_INVALID));
416 Tensor* result;
417 AllocatorAttributes attr;
418 attr.set_on_host(true);
419 OP_REQUIRES_OK(c, c->allocate_output(0, TensorShape{}, &result, attr));
420 result->scalar<Variant>()() = std::move(output);
421 }
422
423 private:
424 DataType element_dtype_;

Callers

nothing calls this directly

Calls 8

TensorShapeFromTensorFunction · 0.85
InvalidArgumentFunction · 0.85
tensorsMethod · 0.80
set_on_hostMethod · 0.80
allocate_outputMethod · 0.80
TensorClass · 0.70
inputMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected