| 97 | // The returned Node pointer is owned by the backing Graph of GraphDefBuilder. |
| 98 | template <typename T> |
| 99 | Status AddScalar(const T& val, Node** output) { |
| 100 | Tensor val_t = Tensor(DataTypeToEnum<T>::v(), TensorShape({})); |
| 101 | val_t.scalar<T>()() = val; |
| 102 | AddTensorInternal(val_t, output); |
| 103 | if (*output == nullptr) { |
| 104 | return errors::Internal("AddScalar: Failed to build Const op."); |
| 105 | } |
| 106 | return Status::OK(); |
| 107 | } |
| 108 | |
| 109 | // Adds a Const node with vector value to the Graph. |
| 110 | // `*output` contains a pointer to the output `Node`. It is guaranteed to be |
no test coverage detected