(self, other)
| 210 | |
| 211 | |
| 212 | def copy_from(self, other): |
| 213 | mine = [t for t in tf.trainable_variables() if t.name.startswith(self.scope)] |
| 214 | mine = sorted(mine, key=lambda v: v.name) |
| 215 | theirs = [t for t in tf.trainable_variables() if t.name.startswith(other.scope)] |
| 216 | theirs = sorted(theirs, key=lambda v: v.name) |
| 217 | |
| 218 | ops = [] |
| 219 | for p, q in zip(mine, theirs): |
| 220 | op = p.assign(q) |
| 221 | ops.append(op) |
| 222 | self.session.run(ops) |
| 223 | |
| 224 | |
| 225 | def save(self): |