code
stringlengths
3
6.57k
assert_almost_equal(p.coef, leg.legint([1,2,3], 1, 0, scl=.5)
self.p2.integ(lbnd=0)
assert_almost_equal(p(0)
self.p2.integ(1, 1)
assert_almost_equal(p.coef, leg.legint([1,2,3], 1, 1, scl=.5)
self.p2.integ(2, [1, 2])
assert_almost_equal(p.coef, leg.legint([1,2,3], 2, [1,2], scl=.5)
test_deriv(self)
self.p2.integ(2, [1, 2])
assert_almost_equal(p.deriv(1)
self.p2.integ(1, [1])
assert_almost_equal(p.deriv(2)
test_roots(self)
leg.Legendre(leg.poly2leg([0, -1, 0, 1])
p.roots()
assert_almost_equal(res, tgt)
test_linspace(self)
np.linspace(0, 1, 20)
self.p2(xdes)
self.p2.linspace(20)
assert_almost_equal(xres, xdes)
assert_almost_equal(yres, ydes)
test_fromroots(self)
leg.Legendre.fromroots(roots, domain=[0, 1])
leg.poly2leg([0, -1, 0, 1])
assert_almost_equal(res, tgt)
test_fit(self)
f(x)
np.linspace(0,3)
f(x)
leg.Legendre.fit(x, y, 3)
assert_almost_equal(p.domain, [0,3])
leg.Legendre.fit(x, y, 3, None)
assert_almost_equal(p(x)
assert_almost_equal(p.domain, [0,3])
leg.Legendre.fit(x, y, 3, [])
assert_almost_equal(p(x)
assert_almost_equal(p.domain, [-1, 1])
np.zeros_like(x)
y.copy()
leg.Legendre.fit(x, yw, 3, w=w)
assert_almost_equal(p(x)
test_identity(self)
np.linspace(0,3)
leg.Legendre.identity()
assert_almost_equal(p(x)
leg.Legendre.identity([1,3])
assert_almost_equal(p(x)
run_module_suite()
method (Callable)
request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsRequest`)
response (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsResponse`)
metadata (Sequence[Tuple[str, str]])
__getattr__(self, name: str)
getattr(self._response, name)
__iter__(self)
__repr__(self)
format(self.__class__.__name__, self._response)
_PSP1x1Conv(in_channels, out_channels)
nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_size=1, bias=False)
nn.BatchNorm2d(out_channels)
nn.ReLU(inplace=True)
_PyramidPooling(nn.Module)
__init__(self, in_channels)
super(_PyramidPooling, self)
__init__()
_PSP1x1Conv(in_channels, out_channels)
_PSP1x1Conv(in_channels, out_channels)
_PSP1x1Conv(in_channels, out_channels)
_PSP1x1Conv(in_channels, out_channels)
pool(x, size)
F.adaptive_avg_pool2d(x, output_size=size)
upsample(x, h, w)
F.interpolate(x, (h, w)
forward(self, x)
self.upsample(self.conv1(self.pool(x, 1)
self.upsample(self.conv2(self.pool(x, 2)
self.upsample(self.conv3(self.pool(x, 3)
self.upsample(self.conv4(self.pool(x, 4)
torch.cat([x, feat1, feat2, feat3, feat4], dim=1)
_PSPHead(nn.Module)
__init__(self, nclass, **kwargs)
super(_PSPHead, self)
__init__(**kwargs)
_PyramidPooling(2048)
list()
self.block.append(nn.Conv2d(4096, 512, kernel_size=3, padding=1, bias=False)
self.block.append(nn.BatchNorm2d(512)
self.block.append(nn.ReLU(inplace=True)
self.block.append(nn.Dropout(0.1)
self.block.append(nn.Conv2d(512, nclass, kernel_size=1)
nn.Sequential(*self.block)
forward(self, x)
self.psp(x)
self.block(x)
PSPNet(SegBaseModel)
super(PSPNet, self)
_PSPHead(nclass, **kwargs)
_FCNHead(1024, nclass, **kwargs)
self.__setattr__('others', ['head', 'auxlayer'] if self.aux else ['head'])