Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何在 Pytorch 中将一维 IntTensor 转换为 int
如何将一维 IntTensor 转换为整数 这 IntTensor int 给出错误 KeyError Variable containing 423 torch IntTensor of size 1 我所知道的最简单 最干净的方法 In
python
Pytorch
tensor
如何使用张量流比较两个数组?
我需要比较两个数组并得到 true 或 false 而不是元素结果 我的代码是 X tf constant 0 05 0 10 dtype tf float32 shape 1 2 y tf constant 0 01 0 99 dtype
python
Arrays
tensorflow
Compare
tensor
如何使用 PyTorch 沿特定维度进行热编码?
我有一个大小的张量 3 15 136 where 3 is batch size 15 sequence length and 136 is tokens 我想使用中的概率来单热我的张量tokens维度 136 为此 我想提取序列长度中每个
python
Pytorch
tensor
onehotencoding
设置 torch.gather(...) 调用的结果
我有一个形状为 n x m 的 2D pytorch 张量 我想使用索引列表来索引第二个维度 可以使用 torch gather 完成 然后然后还设置新值到索引的结果 Example data torch tensor 0 1 2 3 4
python
Indexing
Pytorch
tensor
神经网络 - 我的网络似乎训练得很好,但在分类报告中它是完全随机的
我正在训练一个模型来对 3 种类型的车辆进行分类 一切看起来都很顺利 直到我尝试用我的模型预测任何事情 预测结果是完全随机的 我使用 3 个类别的 15000 张图像 每个类别 5000 个 进行训练 并使用 3 个类别的 6000 个图像
Keras
deeplearning
Classification
convneuralnetwork
tensor
如何在pytorch中动态索引张量?
例如 我有一个张量 tensor torch rand 12 512 768 我得到了一个索引列表 说它是 0 2 3 400 5 32 7 8 321 107 100 511 我希望从给定索引列表的维度 2 上的 512 个元素中选择 1
python
deeplearning
Pytorch
torch
tensor
Eigen::Tensor,如何从Tensor访问矩阵
我有以下特征张量 Eigen Tensor
c
eigen3
tensor
如何在 Eigen3 中重塑张量?
我从 C 中的张量流会话的输出向量中获得了一些 Eigen TensorMap 我想对 Eigen TensorMap 进行一些操作 重塑和连接等 但是 由于一些奇怪的错误 我的代码无法编译 我尝试用纯 Eigen3 代码重现它 inclu
c
tensor
eigen3
PyTorch LSTM 中的“隐藏”和“输出”有什么区别?
我无法理解 PyTorch 的 LSTM 模块 以及类似的 RNN 和 GRU 的文档 关于输出 它说 输出 输出 h n c n 输出 seq len batch hidden size num directions 包含RNN最后一层的
deeplearning
Pytorch
LSTM
recurrentneuralnetwork
tensor
PyTorch 中的连接张量
我有一个张量叫做data形状的 128 4 150 150 其中 128 是批量大小 4 是通道数 最后 2 个维度是高度和宽度 我有另一个张量叫做fake形状的 128 1 150 150 我想放弃最后一个list array从第 2 维
python
machinelearning
Pytorch
tensor
预期设备类型为 cuda 的对象,但在 Pytorch 中获得了设备类型 cpu
我有以下计算损失函数的代码 class MSE loss nn Module metric L1 L2 norms or cosine similarity mode training or evaluation mode def init
python
OOP
Pytorch
tensor
Pytorch Tensor 如何获取元素索引? [复制]
这个问题在这里已经有答案了 我有 2 个名为x and list它们的定义如下 x torch tensor 3 list torch tensor 1 2 3 4 5 现在我想获取元素的索引x from list 预期输出是一个整数 2
python
Pytorch
torch
tensor
从打包序列中获取每个序列的最后一项
我试图通过 GRU 放置打包和填充的序列 并检索每个序列最后一项的输出 当然我的意思不是 1项目 但实际上是最后一个 未填充的项目 我们预先知道序列的长度 因此应该很容易为每个序列提取length 1 item 我尝试了以下方法 impor
Indexing
deeplearning
Pytorch
tensor
zeropadding
为什么 PyTorch nn.Module.cuda() 不将模块张量移动到 GPU,而仅将参数和缓冲区移动到 GPU?
nn Module cuda 将所有模型参数和缓冲区移动到 GPU 但为什么不是模型成员张量呢 class ToyModule torch nn Module def init self gt None super ToyModule se
python
Pytorch
GPU
tensor
Keras 张量 - 使用来自另一个张量的索引获取值
假设我有这两个张量 valueMatrix 形状为 3 where 是批量大小 indexMatrix 形状为 1 我想从中检索值valueMatrix在包含的索引处indexMatrix 示例 伪代码 valueMatrix 7 15 5
python3x
tensorflow
Keras
slice
tensor
删除 Torch 张量中的行
我有一个火炬张量如下 a tensor 0 2215 0 5859 0 4782 0 7411 0 3078 0 3854 0 3981 0 5200 0 1363 0 4060 0 2030 0 4940 0 1640 0 6025 0
python
Pytorch
torch
tensor
使用 argmax 从 Tensor 获取值
我有一个Tensor形状的 60 128 30000 我想得到的值argmax of the 30000方面 axis 2 此代码是一个示例 tensor tf random uniform 60 128 30000 shape 60 12
python
tensorflow
tensorflow20
tensor
Matlab - 访问多维数组的一部分
我正在尝试访问 Matlab 中多维数组的一部分 可以这样做 X 2 3 1 20 5 4 7 然而 元素的数量和范围都不是固定的 所以我想提供数组的索引 对于上面的例子 它们是 ind1 2 1 5 4 ind2 3 20 5 7 对于固
Arrays
MATLAB
tensor
如何使用 torch.stack?
我该如何使用torch stack将两个张量与形状堆叠a shape 2 3 4 and b shape 2 3 没有就地操作 堆叠需要相同数量的维度 一种方法是松开并堆叠 例如 a size 2 3 4 b size 2 3 b torc
python
Pytorch
tensor
训练时如何获得层权重?
我有一个模型 我想获取特定层的权重矩阵 以便在定义自定义损失函数时使用它 有没有办法获得模型内部特定层的权重 附 我目前正在使用 TensorFlow 2 和 keras 功能 API 我测试过如何获取 Keras 中图层的权重 https
python
Keras
deeplearning
tensor
1
2
3
4
5
»