| 949 | |
| 950 | template <typename T> |
| 951 | Status ParseScalarArgument(OpKernelContext* ctx, |
| 952 | const StringPiece& argument_name, T* output) { |
| 953 | const Tensor* argument_t; |
| 954 | TF_RETURN_IF_ERROR(ctx->input(argument_name, &argument_t)); |
| 955 | if (!TensorShapeUtils::IsScalar(argument_t->shape())) { |
| 956 | return errors::InvalidArgument(argument_name, " must be a scalar"); |
| 957 | } |
| 958 | *output = argument_t->scalar<T>()(); |
| 959 | return Status::OK(); |
| 960 | } |
| 961 | |
| 962 | template <typename T> |
| 963 | Status ParseVectorArgument(OpKernelContext* ctx, |
no test coverage detected