| 115 | } |
| 116 | |
| 117 | VariableIndex ComputationGraph::add_function_node(Node *node, Device *device) { |
| 118 | VariableIndex new_node_index((VariableIndex)nodes.size()); |
| 119 | nodes.push_back(node); |
| 120 | if (node->device == nullptr) { |
| 121 | if (node->arity() > 0) { |
| 122 | node->device = nodes[node->args[0]]->device; |
| 123 | } else { |
| 124 | node->device = device == nullptr ? dynet::default_device : device; |
| 125 | } |
| 126 | } |
| 127 | if (node->device->type == DeviceType::GPU && !node->has_cuda_implemented) |
| 128 | DYNET_NO_CUDA_IMPL_ERROR(node->as_dummy_string()) |
| 129 | set_dim_for_new_node(new_node_index); |
| 130 | return new_node_index; |
| 131 | } |
| 132 | |
| 133 | CGCheckpoint ComputationGraph::_get_checkpoint() { |
| 134 | CGCheckpoint p; |
nothing calls this directly
no test coverage detected