小编tal*_*ies的帖子

Armadillo + VS 2015 - 如何与NVBLAS联系

根据标题,是否有一种简单的方法可以在VS 2015中链接Armadillo和NVBLAS?

目前我已经在VS中安装了MKL,一切都运行得很完美.我已经在VS中安装了带有扩展的CUDA Toolkit 8,我可以以某种方式指示Armadillo在CUDA中使用(可用的)BLAS例程吗?

c++ armadillo visual-studio-2015 nvblas

5
推荐指数
0
解决办法
413
查看次数

aleagpu抛出的TypeInitializationException

我试图使用aleagpu但我得到System.TypeInitializationException.我试图谷歌问题是什么,但我找不到任何解决方案,所以请帮助.该计划是最简单的:

class Klazz
{
    private const int N = 100;
    private const int Length = 10000000;
    var gpu = Gpu.Default;// here is the Exception thrown          
    public static void Unmanaged()
    {
        var data = new int[Length];

        for (var k = 0; k < N; k++)
            gpu.For(0, data.Length, i => data[i] += 1); 
    }
}
Run Code Online (Sandbox Code Playgroud)

我想象我的安装有问题,因为该程序是来自aleagpu主页的复制示例.

我的系统是:

  • Windows 10
  • .NET v4.5.2
  • VS 2015社区NVIDIA GPU计算工具包CUDA v8.0

Alea于2016年11月9日从NuGet安装

  • 阿丽亚(3.0.1)
  • Alea.IL(2.2.0.3307)
  • Alea.CUDA(2.2.0.3307)
  • Alea.CUDA.IL(2.2.0.3307)
  • Alea.CUDA.Unbound(2.2.0.3307)

PATH中的变量是正确的.

我已经尝试了AleaSample.CS.ParallelForAutoMemMgt以及相同的结果.

c# aleagpu

5
推荐指数
1
解决办法
705
查看次数

AttributeError: 模块“tensorflow”没有属性“InteractiveSession”

我已经在 Ubuntu 16.10 环境中从 Source 安装了 tensorflow。一切都很顺利,但现在在编译程序时,它显示以下错误:

Traceback (most recent call last):
  File "ff.py", line 3, in <module>
    sess = tf.InteractiveSession()
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
Run Code Online (Sandbox Code Playgroud)

没有找到与此相关的帖子。有人可以帮忙吗?

python tensorflow

5
推荐指数
3
解决办法
3万
查看次数

DEBUG = 1时,YOLO'C'编译失败

我试图编译YOLO GPU = 1,OPENCV = 1,DEBUG = 1.与DEBUG = 0相同的组合已成功编译,但是当我使用DEBUG = 1时,导致编译失败.

>>make
gcc  -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors  -O0 -g -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.o
gcc  -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors  -O0 -g -DOPENCV -DGPU -c ./src/utils.c -o obj/utils.o
gcc  -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors  -O0 -g -DOPENCV -DGPU -c ./src/cuda.c -o obj/cuda.o
gcc  -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors  -O0 -g -DOPENCV -DGPU -c ./src/convolutional_layer.c -o …
Run Code Online (Sandbox Code Playgroud)

opencv gdb

5
推荐指数
2
解决办法
3748
查看次数

如何配置GOOGLE_CUDA?

为了在没有 cuda 的情况下运行 TensorFlow verbs 代码,我用 GOOGLE_CUDA 的定义关闭了部分代码。当我尝试运行代码时,我发现 GOOGLE_CUDA 在我的文件中始终未定义,即使当我使用 cuda 构建 TensorFlow 时也是如此,但在使用它的其他文件中,它已定义。我应该怎么做才能让我的代码知道这个定义?

tensorflow

5
推荐指数
0
解决办法
897
查看次数

第二次调用model.fit()时CNTK内存不足错误

我正在使用Keras和CNTK(后端)

我的代码是这样的:

def run_han(embeddings_index, fname, opt)
    ...
    sentence_input = Input(shape=(MAX_SENT_LENGTH,), dtype='int32')
    embedded_sequences = embedding_layer(sentence_input)
    l_lstm = Bidirectional(GRU(GRU_UNITS, return_sequences=True, kernel_regularizer=l2_reg, 
                           implementation=GPU_IMPL))(embedded_sequences)
    l_att = AttLayer(regularizer=l2_reg)(l_lstm)            
    sentEncoder = Model(sentence_input, l_att)

    review_input = Input(shape=(MAX_SENTS, MAX_SENT_LENGTH), dtype='int32')
    review_encoder = TimeDistributed(sentEncoder)(review_input)
    l_lstm_sent = Bidirectional(GRU(GRU_UNITS, return_sequences=True, kernel_regularizer=l2_reg, 
                                implementation=GPU_IMPL))(review_encoder)
    l_att_sent = AttLayer(regularizer=l2_reg)(l_lstm_sent) 
    preds = Dense(n_classes, activation='softmax', kernel_regularizer=l2_reg)(l_att_sent)
    model = Model(review_input, preds)

    model.compile(loss='categorical_crossentropy',
          optimizer=opt, #SGD(lr=0.1, nesterov=True),
          metrics=['acc'])
   ...
   model.fit(x_train[ind,:,:], y_train[ind,:], epochs=NUM_EPOCHS, batch_size=BATCH_SIZE, shuffle=False, 
          callbacks=[cr_result, history, csv_logger], 
          verbose=2,validation_data=(x_test, y_test), class_weight = class_weight)
   ...
    %xdel model
    gc.collect()
Run Code Online (Sandbox Code Playgroud)

更改优化程序时,我多次调用上述模型。像这样:

opt = optimizers.RMSprop(lr=0.0001, …
Run Code Online (Sandbox Code Playgroud)

python keras cntk

5
推荐指数
1
解决办法
392
查看次数

Pytorch 卷积网络内存使用明细

我正在尝试为一个非常大的输入 (5*100,000,000) 训练一个神经网络,它需要比预期更多的内存。这是一些最小的例子:

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import time

class Net(nn.Module):

    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv1d(in_channels=5, out_channels=1, kernel_size=100000000, stride=10)

    def forward(self, x):
        x = self.conv1(x)
        x = torch.sigmoid(x)
        return x

model = Net().cuda()

optimizer = optim.Adam(model.parameters(), lr=0.001)
criterion = torch.nn.BCELoss()

data = torch.normal(torch.zeros(1,5,100000000),torch.ones(1,5,100000000))
data = data.cuda()
label = torch.ones(1,1,1)
label = label.cuda()

for epoch in range(10):
    output = model(data)
    loss = criterion(output, label)
   
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    
    print("Epoch :", …
Run Code Online (Sandbox Code Playgroud)

gpu neural-network conv-neural-network cudnn

5
推荐指数
1
解决办法
3094
查看次数

Pytorch RuntimeError:参数#1'索引'的期望张量具有标量类型Long; 但是却得到了CUDAType

我试图通过嵌入在计算机上重新执行GitHub项目以进行推荐,目的是在完成集成后首先嵌入存在于movieLens数据集中的用户和项目,然后使用内部产品来预测评分在所有组件中,我在训练中都出错了。

码:

from lightfm.datasets import fetch_movielens
movielens = fetch_movielens()
ratings_train, ratings_test = movielens['train'], movielens['test']
def _binarize(dataset):

    dataset = dataset.copy()

    dataset.data = (dataset.data >= 0.0).astype(np.float32)
    dataset = dataset.tocsr()
    dataset.eliminate_zeros()

    return dataset.tocoo()
train, test = _binarize(movielens['train']), _binarize(movielens['test'])
class ScaledEmbedding(nn.Embedding):
    """ Change the scale from normal to [0,1/embedding_dim] """
    def reset_parameters(self):
        self.weight.data.normal_(0, 1.0 / self.embedding_dim)
        if self.padding_idx is not None:
            self.weight.data[self.padding_idx].fill_(0)


class ZeroEmbedding(nn.Embedding):

    def reset_parameters(self):
        self.weight.data.zero_()
        if self.padding_idx is not None:
            self.weight.data[self.padding_idx].fill_(0)
class BilinearNet(nn.Module):

    def __init__(self, num_users, num_items, embedding_dim, sparse=False):
        super().__init__()

        self.embedding_dim = …
Run Code Online (Sandbox Code Playgroud)

embedding python-3.x torch pytorch

5
推荐指数
2
解决办法
2098
查看次数

python numba中非常大的整数

我正在研究密码学,其中包括非常大的大约2048位大小的整数。我已经在 python 中返回了我的算法并且工作正常。现在,我需要用 GPU 加速这个算法。所以,我使用 numba 进行加速。我收到以下错误。请帮助我处理非常大的整数。

ValueError异常:int值过大:92258844410360056197837473187695644910346254368316703862914922507771377266980480337680534948953927388850060454071957519321942465209478761155937984413689971094452635917678279011141842700271439588766362468089643758626551820024243785880479259172494136586386527772928225026351839534218119545890907368759523376112

python numba

5
推荐指数
1
解决办法
370
查看次数

CMake 错误...:DNN:CUDA 后端需要 CUDA 工具包。请解决依赖性或禁用 OPENCV_DNN_CUDA=OFF

这是我在 ubuntu 20.04 上使用 cuda 10.1 编译 OpenCV 时遇到的错误。

-- Detected processor: x86_64
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
  Unexpected option: WITH_CUBLAS (=ON)

  Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
  CMakeLists.txt:249 (OCV_OPTION)


CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
  Unexpected option: WITH_CUDNN (=ON)

  Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
  CMakeLists.txt:252 (OCV_OPTION)


-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Could NOT find OpenJPEG (minimal suitable version: …
Run Code Online (Sandbox Code Playgroud)

opencv cmake ubuntu-20.04

5
推荐指数
1
解决办法
8456
查看次数