我在一些代码中看到,peaple定义了一个变量并分配了例如1e-8或1e5之类的值
const int MAXN = 1e5 + 123;
Run Code Online (Sandbox Code Playgroud)
这些数字是什么?!我在网上找不到任何东西......
我正试着看一看.到目前为止,我写了这个:
with ExpAndCheapMedicine(MostMoney, MinMoney) as
(
select max(unitprice), min(unitprice)
from Medicine
)
,
findmostexpensive(nameOfExpensive) as
(
select tradename
from Medicine, ExpAndCheapMedicine
where UnitPrice = MostMoney
)
,
findCheapest(nameOfCheapest) as
(
select tradename
from Medicine, ExpAndCheapMedicine
where UnitPrice = MinMoney
)
CREATE VIEW showing
as
select tradename, unitprice, GenericFlag
from Medicine;
Run Code Online (Sandbox Code Playgroud)
不幸的是,我在包含的行上收到错误 CREATE VIEW showing
"CREATE VIEW必须是批处理中唯一的声明"
我怎样才能解决这个问题?!
我正在尝试按照官方网站上的说明使用 github 和 jekyll 制作我的个人网站
当我到达该部分时:
jekyll new --skip-bundle
Run Code Online (Sandbox Code Playgroud)
我收到了:
can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)
Run Code Online (Sandbox Code Playgroud)
我尝试了几种方法,例如这里提到的一种方法,我使用 运行命令sudo
。再次运行后jekyll new --skip-bundle
。
这是按照此处的说明安装后的终端响应
Fetching bundler-2.4.5.gem
Successfully installed bundler-2.4.5
Parsing documentation for bundler-2.4.5
Installing ri documentation for bundler-2.4.5
Done installing documentation for bundler after 0 seconds
1 gem installed
Run Code Online (Sandbox Code Playgroud)
这是我jekyll new --skip-bundle
再次运行时的终端响应:
Traceback (most recent call last):
2: from /usr/local/bin/jekyll:22:in `<main>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:262:in `bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find …
Run Code Online (Sandbox Code Playgroud) 根据我之前的问题,我编写了这段代码来训练自动编码器,然后提取特征。(变量名可能有一些变化)
# Autoencoder class
#https://medium.com/pytorch/implementing-an-autoencoder-in-pytorch-19baa22647d1
class AE_class(nn.Module):
def __init__(self, **kwargs):
super().__init__()
self.encoder_hidden_layer = nn.Linear(
in_features=kwargs["input_shape"], out_features=128
)
self.encoder_output_layer = nn.Linear(
in_features=128, out_features=128
)
self.decoder_hidden_layer = nn.Linear(
in_features=128, out_features=128
)
self.decoder_output_layer = nn.Linear(
in_features=128, out_features=kwargs["input_shape"]
)
def forward(self, features):
#print("in forward")
#print(type(features))
activation = self.encoder_hidden_layer(features)
activation = torch.relu(activation)
code = self.encoder_output_layer(activation)
code = torch.relu(code)
activation = self.decoder_hidden_layer(code)
activation = torch.relu(activation)
activation = self.decoder_output_layer(activation)
reconstructed = torch.relu(activation)
return reconstructed
def encode(self, features_h):
activation_h = self.encoder_hidden_layer(features_h)
activation_h = torch.relu(activation_h)
code_h = …
Run Code Online (Sandbox Code Playgroud) 我有一个矩阵保存为 numpy 类型,称之为“X_before”(例如,它的形状是 100*30)。
因为我想使用 Pytorch 库将其提供给 AutoEncoder,所以我将其转换为torch.tensor
如下所示:
X_tensor = torch.from_numpy(X_before, dtype=torch)
Run Code Online (Sandbox Code Playgroud)
然后,我收到以下错误:
Run Code Online (Sandbox Code Playgroud)expected scalar type Float but found Double
接下来,我尝试将元素设置为“float”,然后将它们转换为 torch.tensor:
X_before = X_before.astype(float)
X_tensor = torch.from_numpy(X_before)
Run Code Online (Sandbox Code Playgroud)
同样的错误再次发生。我应该如何解决这个问题?如何将 torch.tensor 对象中的元素类型转换为另一种类型?
提前致谢
所以我创建了这个数组作为例子:
a = np.array([[1, 1, 1, 1, 2], [2, 2, 2, 3], [3, 3, 3, 4], [13, 49, 13, 49], [10, 10, 2, 2],
[11, 1, 1, 1, 2], [22, 2, 2, 3], [33, 3, 3, 4], [133, 49, 13, 49], [100, 10, 2, 2],
[5, 1, 1, 1, 2], [32, 2, 2, 3], [322, 3, 3, 4], [13222, 49, 13, 49], [130, 10, 2, 2]])
Run Code Online (Sandbox Code Playgroud)
我想创建一个二维数组。因此,例如在这种情况下,15*5 数组。
但是,当我使用 时a.shape
,它返回(15,)
我的数组定义有什么问题?
我有三张桌子:
演员
id
nameofactor
Run Code Online (Sandbox Code Playgroud)
电影
id
nameOfmovie
Run Code Online (Sandbox Code Playgroud)
铸
actorid
movieid
role
Run Code Online (Sandbox Code Playgroud)
我想展示在电影中扮演多个角色的演员的名字
这是我尝试过的:
select
nameOfactor, nameOfmovie, CASTS.role
from
ACTOR, MOVIE, CASTS
where
ACTOR.id = CASTS.actorid
and CASTS.mid = MOVIE.movieid
group by
fname, lname, name, role
having
count(pid) >= 2;
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
我想问题就是这样我必须把"角色"放在分组中,但是因为我需要展示角色,所以我不得不这样做
我不知道如何解决这个问题.如果有人能提供帮助,我会很高兴
提前致谢
arrays ×2
autoencoder ×2
python ×2
pytorch ×2
sql ×2
sql-server ×2
casting ×1
create-view ×1
debugging ×1
github-pages ×1
gpu ×1
jekyll ×1
numbers ×1
numpy ×1
python-3.x ×1
ruby ×1
rubygems ×1
tensor ×1