def broadcasted(self, shape): """Broadcasts the Characteristic to shape SHAPE by broadcast()'ing the contained Dependencies. Thus, for documentation, see Dependency.broadcast(). This method acts not in-place.""" result = Characteristic(shape = shape) for dependency in self.dependencies: result.append(dependency.broadcasted(shape)) return result
def broadcast(self, shape): """Broadcasts the Characteristic to shape SHAPE by broadcast()'ing the contained Dependencies. Thus, for documentation, see Dependency.broadcast(). This method acts in-place.""" # Emulate the in-place behaviour by replacing the dependencies. dependencies = self.dependencies self.dependencies = [] for dependency in dependencies: self.append(dependency.broadcasted(shape))