def _random_position(self, sigma): return first( filter( lambda p: all( map(lambda b: (b.position - p).length >= 50, concat(self.cars, self.obstacles, self.stars))), filter( lambda p: 100 < p.length < 950, repeatedly(lambda: pymunk.Vec2d( self.game_random.gauss(0, sigma), 0).rotated( self.game_random.uniform(0, pi * 2))))))
def residual_block(filter_size, stride_size, unit_size): return rcompose(first_residual_unit(filter_size, stride_size), rcompose(*repeatedly(partial(residual_unit, filter_size), unit_size - 1)))
def chunk_reader(fileobject, chunk_size): """Read data from fileobject by chunks.""" return itertools.takewhile(bool, # break when chunk is empty funcy.repeatedly(lambda: fileobject.read(chunk_size)))
def residual_block(filter_size, unit_size): return rcompose( zero_padding(filter_size), rcompose(*repeatedly(partial(residual_unit, filter_size), unit_size)))
def call(self, x): if self.input_channel_size == self.output_channel_size: return x else: return K.concatenate((x, K.concatenate(tuple(repeatedly(partial(K.zeros_like, x), self.output_channel_size // self.input_channel_size - 1)))))