| 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 |
nothing calls this directly
no test coverage detected