小编enc*_*enc的帖子

卸载应用程序时删除钥匙串项

我正在使用idandersen的scifihifi-iphone代码进行钥匙串和使用保存密码

[SFHFKeychainUtils storeUsername:@"User" andPassword:@"123"
              forServiceName:@"TestService" updateExisting:YES error:&error];
Run Code Online (Sandbox Code Playgroud)

当我从设备中删除应用程序时,密码仍保留在钥匙串中.

我想在用户从设备中删除应用程序时从密钥链中删除密码.我怎样才能做到这一点?

objective-c keychain ios

233
推荐指数
7
解决办法
9万
查看次数

推测和预测之间的差异

在计算机架构中,

(分支)预测和推测之间有什么区别?

这些似乎非常相似,但我认为它们之间存在微妙的区别.

cpu-architecture prediction speculative-execution

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

使用tfprof分析TensorFlow

我试图描述TensorFlow的计算/内存使用情况,发现tfprof是一个适合我目的的正确工具.但是,我无法获得所有运营商的FLOPS.

以下是我使用TensorFlow存储库中的cifar10教程(tensorflow/models/image/cifar10/cifar10_train.py)执行tfprof教程后所做的事情:

run_metadata = tf.RunMetadata()

_, loss_value = sess.run([train_op, loss],
        options=tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE),
        run_metadata=run_metadata)

op_log = tfprof_log_pb2.OpLog()

// TODO: add op information

tf.contrib.tfprof.tfprof_logger.write_op_log(
        tf.get_default_graph(),
        log_dir="/tmp/log_dir",
        op_log=op_log,
        run_meta=run_metadata)

tf.contrib.tfprof.model_analyzer.print_model_analysis(
        tf.get_default_graph(),
        run_metadata=run_metadata,
        op_log=op_log,
        tfprof_options=tf.contrib.tfprof.model_analyzer.FLOAT_OPS_OPTIONS)
Run Code Online (Sandbox Code Playgroud)

结果是

Parsing GraphDef...
Parsing RunMetadata...
Parsing OpLog...
Preparing Views...

=========================Options=============================
-max_depth                  10000
-min_bytes                  0
-min_micros                 0
-min_params                 0
-min_float_ops              1
-device_regexes             .*
-order_by                   float_ops
-account_type_regexes       .*
-start_name_regexes         .*
-trim_name_regexes
-show_name_regexes          .*
-hide_name_regexes
-account_displayed_op_only  true
-select                     float_ops
-viz                        false
-dump_to_file

==================Model Analysis Report======================
_TFProfRoot (0/5.23b flops)
  conv2/Conv2D (3.77b/3.77b flops) …
Run Code Online (Sandbox Code Playgroud)

profiling gpu tensorflow

6
推荐指数
1
解决办法
3555
查看次数

TensorFlow中CPU和GPU之间的DMA

我在NVidia Jetson TX1上运行TensorFlow,当我训练像GoogleNet这样的大型网络时,我遇到内存不足.

TX1中的CPU和GPU没有单独的内存,它们共享一个内存.但是,似乎TensorFlow正在尝试分配单独的内存空间并从CPU端复制到GPU端.因此它需要2倍的内存而不是真正需要的内存.

在我看来,这种情况可以通过CPU和GPU之间的DMA访问来处理.据我所知,TensorFlow在GPU之间使用DMA(不确定哪一个处理这个.TensorFlow?或GPU驱动程序?).我可以在TensorFlow中使用CPU和GPU之间的DMA吗?或任何其他建议?

编辑:我刚刚发现CUDA中有零拷贝功能,这正是我想要的.但是,我可以在TensorFlow中使用此功能吗?

memory tegra tensorflow

6
推荐指数
0
解决办法
670
查看次数

在C++中奇怪地使用构造函数

我正在尝试理解用C++编写的其他人的代码,但是我从未见过构造函数的奇怪用法.代码如下所示:

A* a = new A(some initial values...);
...
B* b = new (a) B(some initial values...);
Run Code Online (Sandbox Code Playgroud)

初始化变量时b,(a)new和之间B(...).这是什么意思?

c++ constructor

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

C 语言中的 CPU 频率缩放 linux API

我想在 linux(Ubuntu) 上的程序中更改 cpu(ARM) 频率。

在 C 中是否有任何 CPU 频率缩放和关闭核心 API?

如果有的话,API 可以处理多核 cpu 中的每个核心吗?

linux api arm frequency

4
推荐指数
1
解决办法
3052
查看次数

使用__float128编译C++代码

我正在尝试__float128在我的C++程序中使用.

但是我在编译时遇到了麻烦.

这是简单的c ++代码(test.cc):

#include <iostream>
#include <quadmath.h>

using namespace std;

int main(){
  __float128 r=0.0q;
  __float128 exp_d = expq(12.45q);

  cout << "r=" << (double)r << endl;
  cout << "exp_d=" << (double)exp_d << endl;
}
Run Code Online (Sandbox Code Playgroud)

我用这个代码编译

g++ test.cc -lquadmath -std=c++11

附带以下错误

error:unable to find numeric literal operator 'operateor"" q'

我该如何解决?

c++ g++ c++11

4
推荐指数
1
解决办法
4702
查看次数

uniform_real_distribution()的最小值

在我的程序中,我使用生成0到1之间的均匀随机数 uniform_real_distribution()

#include <random>

default_random_engine e;
uniform_real_distribution<double> u(0,1);

double rand_num = u(e);
Run Code Online (Sandbox Code Playgroud)

我想知道除了0之外,生成的随机数的最小值是多少,即两个随机数之间的最小间隙.

c++ random c++11

2
推荐指数
1
解决办法
150
查看次数