小编tid*_*idy的帖子

如何为CMake指定新的GCC路径

我的操作系统是centos,它在路径中有一个默认的gcc /usr/bin/gcc.但它已经老了,我需要一个新版本的gcc.所以我在新路径中安装了新版本/usr/local/bin/gcc.

但是当我运行时cmake,它仍然使用旧版本的gcc path(/usr/bin/gcc).如何将gcc指定为新路径(/usr/local/bin/gcc).

我试图覆盖/usr/bin/gcc/usr/local/bin/gcc,但它不能正常工作.

gcc cmake

101
推荐指数
4
解决办法
14万
查看次数

什么是XLA_GPU和XLA_CPU for tensorflow

我可以列出gpu设备唱下面的tensorflow代码:

import tensorflow as tf
from tensorflow.python.client import device_lib
print device_lib.list_local_devices()
Run Code Online (Sandbox Code Playgroud)

结果是:

[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 17897160860519880862, name: "/device:XLA_GPU:0"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 9751861134541508701
 physical_device_desc: "device: XLA_GPU device", name: "/device:XLA_CPU:0"
 device_type: "XLA_CPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 5368380567397471193
 physical_device_desc: "device: XLA_CPU device", name: "/device:GPU:0"
 device_type: "GPU"
 memory_limit: 21366299034
 locality {
   bus_id: 1
   links {
     link {
       device_id: 1
       type: "StreamExecutor"
       strength: 1
     }
   }
 }
 incarnation: 7110958745101815531
 physical_device_desc: "device: …
Run Code Online (Sandbox Code Playgroud)

python gpu tensorflow

19
推荐指数
1
解决办法
1万
查看次数

如何在训练弱学习者使用adaboost时使用体重

以下是adaboost算法: 在此输入图像描述

它在第3.1部分提到了"对训练数据使用权重".

我不太清楚如何使用重量.我应该重新取样培训数据吗?

machine-learning adaboost

12
推荐指数
1
解决办法
9390
查看次数

为什么形状索引特征在面部对齐方面如此有效?

我最近实现了一些面部对齐算法.我看过以下文件:

所有论文都提到了一个重要的关键词:shape-indexed-featurepose-indexed-feature.此功能在面部对齐过程中起着关键作用.我没有得到这个功能的关键点.为什么这么重要?

opencv face-recognition computer-vision face-detection

12
推荐指数
1
解决办法
992
查看次数

为什么为 tf.keras.layers.LSTM 设置 return_sequences=True 和 stateful=True?

我正在学习 tensorflow2.0 并按照教程进行操作。在rnn示例中,我找到了代码:

def build_model(vocab_size, embedding_dim, rnn_units, batch_size):
  model = tf.keras.Sequential([
    tf.keras.layers.Embedding(vocab_size, embedding_dim, 
                              batch_input_shape=[batch_size, None]),
    tf.keras.layers.LSTM(rnn_units, 
                        return_sequences=True, 
                        stateful=True, 
                        recurrent_initializer='glorot_uniform'),
    tf.keras.layers.Dense(vocab_size)
  ])
  return model
Run Code Online (Sandbox Code Playgroud)

我的问题是:为什么代码设置了参数return_sequences=Truestateful=True?如何使用默认参数?

lstm keras tensorflow recurrent-neural-network

8
推荐指数
3
解决办法
4138
查看次数

logging.info和logging.getLogger().info之间有什么区别?

我是蟒蛇的新人.

如果logging.info()足以进行日志记录,为什么我们必须使用getLogger()方法实例化记录器?

python logging

7
推荐指数
1
解决办法
1230
查看次数

我怎么知道训练数据足以进行机器学习

例如:如果我想训练分类器(可能是SVM),我需要收集多少样本?这有一种衡量方法吗?

classification machine-learning sample-data

7
推荐指数
2
解决办法
8338
查看次数

如何使用C++为tensorflow加载检查点和推理?

我有Tensorflow与python api并获得这些检查点模型文件:

model.ckpt-17763.data-00000-of-00001
model.ckpt-17763.index
model.ckpt-17763.meta
Run Code Online (Sandbox Code Playgroud)

但是在集成到生产环境中时,我想要一个C/C++共享库(.so文件).所以我需要使用C++代码加载这些模型文件和推理并编译到共享库.这样做有一些教程或样本吗?

c++ deep-learning conv-neural-network tensorflow tensorflow-serving

7
推荐指数
1
解决办法
7979
查看次数

如果未设置 tf.stop_gradient 会发生什么?

我正在阅读faster-rcnntensorflow 模型的代码。我对使用tf.stop_gradient.

考虑以下代码片段:

if self._is_training:
    proposal_boxes = tf.stop_gradient(proposal_boxes)
    if not self._hard_example_miner:
    (groundtruth_boxlists, groundtruth_classes_with_background_list, _,
     groundtruth_weights_list
    ) = self._format_groundtruth_data(true_image_shapes)
    (proposal_boxes, proposal_scores,
     num_proposals) = self._sample_box_classifier_batch(
         proposal_boxes, proposal_scores, num_proposals,
         groundtruth_boxlists, groundtruth_classes_with_background_list,
         groundtruth_weights_list)
Run Code Online (Sandbox Code Playgroud)

更多代码在这里。我的问题是:如果tf.stop_gradient没有设置为会发生什么proposal_boxes

python object-detection tensorflow tensorflow-model-analysis

7
推荐指数
1
解决办法
258
查看次数

RuntimeError:梯度计算所需的变量之一已被原位操作修改?

pytorch-1.5用来做一些gan测试。我的代码是非常简单的 gan 代码,只适合 sin(x) 函数:

import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt


# Hyper Parameters
BATCH_SIZE = 64
LR_G = 0.0001
LR_D = 0.0001 
N_IDEAS = 5  
ART_COMPONENTS = 15 
PAINT_POINTS = np.vstack([np.linspace(-1, 1, ART_COMPONENTS) for _ in range(BATCH_SIZE)])


def artist_works():  # painting from the famous artist (real target)
    r = 0.02 * np.random.randn(1, ART_COMPONENTS)
    paintings = np.sin(PAINT_POINTS * np.pi) + r
    paintings = torch.from_numpy(paintings).float()
    return paintings


G = …
Run Code Online (Sandbox Code Playgroud)

python computer-vision deep-learning pytorch generative-adversarial-network

7
推荐指数
1
解决办法
3071
查看次数