| 684 | // Shape functions ----------------------------------------------------------- |
| 685 | |
| 686 | void TF_GraphSetTensorShape(TF_Graph* graph, TF_Output output, |
| 687 | const int64_t* dims, const int num_dims, |
| 688 | TF_Status* status) { |
| 689 | Node* node = &output.oper->node; |
| 690 | |
| 691 | mutex_lock l(graph->mu); |
| 692 | tensorflow::shape_inference::InferenceContext* ic = |
| 693 | graph->refiner.GetContext(node); |
| 694 | if (ic == nullptr) { |
| 695 | status->status = |
| 696 | InvalidArgument("Node ", node->name(), " was not found in the graph"); |
| 697 | return; |
| 698 | } |
| 699 | tensorflow::shape_inference::ShapeHandle new_shape = |
| 700 | tensorflow::ShapeHandleFromDims(ic, num_dims, dims); |
| 701 | status->status = graph->refiner.SetShape(node, output.index, new_shape); |
| 702 | } |
| 703 | |
| 704 | int TF_GraphGetTensorNumDims(TF_Graph* graph, TF_Output output, |
| 705 | TF_Status* status) { |