prompt stringlengths 1.24k 2.52M | target stringlengths 28 111k |
|---|---|
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def write_pfm(path, image, scale=1):
"""Write pfm file.
Args:
path (str): pathto file
image (array): data
scale (int, optional): Scale. Defaults to 1.
"""
with open(path, "wb") as file:
color = None
if image.dtype.name != "float32":
raise Exception(... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def forward(self):
"""Run forward pass; called by both functions <optimize_parameters> and <test>."""
if hasattr(self, 'real_A'):
self.fake_B = self.nets['netG_A'](self.real_A) # G_A(A)
self.rec_A = self.nets['netG_B'](self.fake_B) # G_B(G_A(A))
# visual
... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def kaiming_normal_(x, a=0, mode='fan_in', nonlinearity='leaky_relu'):
"""Fills the input `Tensor` with values according to the method
described in `Delving deep into rectifiers: Surpassing human-level
performance on ImageNet classification` - He, K. et al. (2015), using a
normal distribution. The resul... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def calculate_ssim(img1,
img2,
crop_border,
input_order='HWC',
test_y_channel=False):
"""Calculate SSIM (structural similarity).
Ref:
Image quality assessment: From error visibility to structural similarity
The results are the... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def __init__(self,
generator,
discriminator=None,
cycle_criterion=None,
idt_criterion=None,
gan_criterion=None,
pool_size=50,
direction='a2b',
lambda_a=10.,
lambda_b=1... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def __init__(self,
generator,
discriminator=None,
cycle_criterion=None,
idt_criterion=None,
gan_criterion=None,
l1_criterion=None,
l2_criterion=None,
pool_size=50,
dir... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def __init__(self,
generator,
discriminator=None,
gan_criterion=None,
num_style_feat=512,
mixing_prob=0.9,
r1_reg_weight=10.,
path_reg_weight=2.,
path_batch_shrink=2.,
... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def __init__(self, cfg):
"""Initialize the AnimeGANV2 class.
Parameters:
opt (config dict)-- stores all the experiment flags; needs to be a subclass of Dict
"""
super(AnimeGANV2Model, self).__init__(cfg)
# define networks (both generator and discriminator)
se... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def __init__(self, generator, discriminator=None, gan_criterion=None):
"""Initialize the DCGAN class.
Args:
generator (dict): config of generator.
discriminator (dict): config of discriminator.
pixel_criterion (dict): config of pixel criterion.
gan_criteri... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def McWilliams(x, y, Re, **kwargs):
"""
Generates McWilliams vorticity field, see:
McWilliams (1984), "The emergence of isolated coherent vortices in turbulent flow"
"""
# Fourier mesh
nx = len(x); kx = np.fft.fftfreq(nx, d=1./nx)
ny = len(y); ky = np.fft.fftfreq(ny, d=1./ny)
nk = ny... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def DecayingTurbulence(x, y, Re, **kwargs):
"""
Generates random vorticity field, see:
Omer San, Anne E. Staples : High-order methods for decaying two-dimensional homogeneous isotropic turbulence
"""
# Fourier mesh
nx = len(x); kx = np.fft.fftfreq(nx, d=1./nx)
ny = len(y); ky = np.fft.ff... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def is_same_transform(matrix0, matrix1):
"""Return True if two matrices perform same transformation.
>>> is_same_transform(numpy.identity(4), numpy.identity(4))
True
>>> is_same_transform(numpy.identity(4), random_rotation_matrix())
False
"""
matrix0 = numpy.array(matrix0, dtype=numpy.floa... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def reflection_matrix(point, normal):
"""Return matrix to mirror at plane defined by point and normal vector.
>>> v0 = numpy.random.random(4) - 0.5
>>> v0[3] = 1.
>>> v1 = numpy.random.random(3) - 0.5
>>> R = reflection_matrix(v0, v1)
>>> numpy.allclose(2, numpy.trace(R))
True
>>> numpy... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def next(self, acceleration=0.0):
"""Continue rotation in direction of last drag."""
q = quaternion_slerp(self._qpre, self._qnow, 2.0+acceleration, False)
self._qpre, self._qnow = self._qnow, q |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def arcball_constrain_to_axis(point, axis):
"""Return sphere point perpendicular to axis."""
v = numpy.array(point, dtype=numpy.float64, copy=True)
a = numpy.array(axis, dtype=numpy.float64, copy=True)
v -= a * numpy.dot(a, v) # on plane
n = vector_norm(v)
if n > _EPS:
if v[2] < 0.0:
... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def euler_from_matrix(matrix, axes='sxyz'):
"""Return Euler angles from rotation matrix for specified axis sequence.
axes : One of 24 axis sequences as string or encoded tuple
Note that many Euler angle triplets can describe one matrix.
>>> R0 = euler_matrix(1, 2, 3, 'syxz')
>>> al, be, ga = eule... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def drag(self, point):
"""Update current cursor window coordinates."""
vnow = arcball_map_to_sphere(point, self._center, self._radius)
if self._axis is not None:
vnow = arcball_constrain_to_axis(vnow, self._axis)
self._qpre = self._qnow
t = numpy.cross(self._vdown, vn... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def log(the_plot, message):
"""Log a message for eventual disposal by the game engine user.
Here, "game engine user" means a user interface or an environment interface,
for example. (Clients are not required to deal with messages, but if they do,
this is how to get a message to them.)
Most game implementati... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def testPlotStateVariables(self):
"""State variables inside the Plot are updated correctly."""
# Our test takes place in this very tiny world:
art = ['.abc.']
# Here we make the game.
engine = ascii_art.ascii_art_to_game(
art=art, what_lies_beneath='.',
# a, b, and c are sprites.
... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def its_showtime(self):
"""Finalise `Engine` set-up and compute the first observation of the game.
Switches the `Engine` from set-up mode, where more `Sprite`s and `Drape`s
can be added, to "play" mode, where gameplay iterates via the `play` method.
After this permanent modal switch, no further calls t... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 8