| 1561 | |
| 1562 | namespace { |
| 1563 | Node* scalar_const_node(Graph* g, int64 val, const string& name, |
| 1564 | const string& device_name) { |
| 1565 | Node* ret; |
| 1566 | Tensor t(DT_INT32, TensorShape({})); |
| 1567 | t.scalar<int32>()() = val; |
| 1568 | TF_CHECK_OK(NodeBuilder(g->NewName(name), "Const") |
| 1569 | .Device(device_name) |
| 1570 | .Attr("dtype", DT_INT32) |
| 1571 | .Attr("value", t) |
| 1572 | .Finalize(g, &ret)); |
| 1573 | ret->set_assigned_device_name(device_name); |
| 1574 | return ret; |
| 1575 | } |
| 1576 | |
| 1577 | Node* tensor_const_node(Graph* g, Tensor& t, const string& name, |
| 1578 | const string& device_name) { |
no test coverage detected