Operations returns a list of all operations in the graph
()
| 162 | |
| 163 | // Operations returns a list of all operations in the graph |
| 164 | func (g *Graph) Operations() []Operation { |
| 165 | var pos C.size_t |
| 166 | ops := []Operation{} |
| 167 | for { |
| 168 | cop := C.TF_GraphNextOperation(g.c, &pos) |
| 169 | if cop == nil { |
| 170 | break |
| 171 | } |
| 172 | ops = append(ops, Operation{cop, g}) |
| 173 | } |
| 174 | return ops |
| 175 | } |
| 176 | |
| 177 | // AddGradients adds operations to compute the partial derivatives of the sum of tensors in y |
| 178 | // with respect to tensors in x, i.e., d(y[0] + y[1] + ...) / d x[0], d(y[0] + y[1] + ... ) / d x[1] etc. |