| 489 | |
| 490 | template<typename T> |
| 491 | Status GetScalar( |
| 492 | OpKernelContext* ctx, int id, const char* name, |
| 493 | T* result) { |
| 494 | const Tensor& tensor = ctx->input(id); |
| 495 | if (!TensorShapeUtils::IsScalar(tensor.shape())) { |
| 496 | return errors::InvalidArgument(name, " is not a scalar: ", |
| 497 | tensor.shape().DebugString()); |
| 498 | } |
| 499 | *result = tensor.scalar<T>()(); |
| 500 | return Status::OK(); |
| 501 | } |
| 502 | |
| 503 | template<typename T> |
| 504 | T* GetData(const Tensor& tensor) { |
nothing calls this directly
no test coverage detected