Consumers returns the inputs that consume this output.
()
| 136 | |
| 137 | // Consumers returns the inputs that consume this output. |
| 138 | func (p Output) Consumers() []Consumer { |
| 139 | max := int(C.TF_OperationOutputNumConsumers(p.c())) |
| 140 | if max == 0 { |
| 141 | return nil |
| 142 | } |
| 143 | inputs := make([]C.TF_Input, max) |
| 144 | n := C.TF_OperationOutputConsumers(p.c(), (*C.TF_Input)(unsafe.Pointer(&inputs[0])), C.int(max)) |
| 145 | inputs = inputs[:int(n)] |
| 146 | |
| 147 | var consumers []Consumer |
| 148 | for _, consumer := range inputs { |
| 149 | consumers = append(consumers, Consumer{ |
| 150 | Index: int(consumer.index), |
| 151 | Op: &Operation{ |
| 152 | c: consumer.oper, |
| 153 | g: p.Op.g, |
| 154 | }, |
| 155 | }) |
| 156 | } |
| 157 | |
| 158 | return consumers |
| 159 | } |
| 160 | |
| 161 | // Consumer identifies a specific input of an operation that consumes the output |
| 162 | // of another operation. |