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

Method Compute

tensorflow/core/kernels/shape_ops.cc:473–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471 }
472
473 void Compute(OpKernelContext* ctx) override {
474 TensorShape shape;
475 OP_REQUIRES_OK(ctx, shape_op_helpers::GetShape(ctx, 0, &shape));
476
477 if (!expected_shape_.IsCompatibleWith(shape)) {
478 ctx->SetStatus(errors::InvalidArgument(
479 "Shape of tensor ", this->def().input(0), " ", shape.DebugString(),
480 " is not compatible with expected shape ",
481 expected_shape_.DebugString(), "."));
482 }
483
484 // If shape matches, outputs the tensor.
485 if (IsRefType(ctx->input_dtype(0))) {
486 ctx->forward_ref_input_to_ref_output(0, 0);
487 } else {
488 ctx->set_output(0, ctx->input(0));
489 }
490 }
491
492 bool IsExpensive() override { return false; }
493

Callers

nothing calls this directly

Calls 10

InvalidArgumentFunction · 0.85
IsRefTypeFunction · 0.85
GetShapeFunction · 0.70
IsCompatibleWithMethod · 0.45
SetStatusMethod · 0.45
inputMethod · 0.45
DebugStringMethod · 0.45
input_dtypeMethod · 0.45
set_outputMethod · 0.45

Tested by

no test coverage detected