小编Gen*_*337的帖子

Tensorflow - 如何为tf.Estimator()CNN使用GPU而不是CPU

我认为应该和它一起使用with tf.device("/gpu:0"),但我应该把它放在哪里?我认为不是:

with tf.device("/gpu:0"):
    tf.app.run()
Run Code Online (Sandbox Code Playgroud)

所以,我应该把它在main()功能tf.app,或我使用的估计模型的功能?

编辑:如果这有帮助,这是我的main()功能:

def main(unused_argv):
  """Code to load training folds data pickle or generate one if not present"""

  # Create the Estimator
  mnist_classifier = tf.estimator.Estimator(
      model_fn=cnn_model_fn2, model_dir="F:/python_machine_learning_codes/tmp/custom_age_adience_1")

  # Set up logging for predictions
  # Log the values in the "Softmax" tensor with label "probabilities"
  tensors_to_log = {"probabilities": "softmax_tensor"}
  logging_hook = tf.train.LoggingTensorHook(
      tensors=tensors_to_log, every_n_iter=100)

  # Train the model
  train_input_fn = tf.estimator.inputs.numpy_input_fn(
      x={"x": train_data},
      y=train_labels,
      batch_size=64,
      num_epochs=None,
      shuffle=True)
  mnist_classifier.train(
      input_fn=train_input_fn, …
Run Code Online (Sandbox Code Playgroud)

python tensorflow tensorflow-estimator

8
推荐指数
1
解决办法
6365
查看次数

如何为API 21/Lollipop以下的设备实现setZ()?

我已经成功实现了一个拖动幻灯片动画,其setZ()功能如下:

dragAnimSet.setAnimationListener(new Animation.AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {
        ((ViewGroup)sourceParent.getParent()).setClipChildren(false);
        for(int a = 0; a < ifvList.size(); a++)
        {
            if(a != sourceIndex && a != indexInListener)
            {
                ifvList.get(a).setZ(-20);
            }
        }
        if(sourceParent.indexOfChild(toReplace) != -1 && toReplaceParent.indexOfChild(source) != -1) {
            source.setZ(-10);
        } else {
            sourceParent.setZ(-10);
        }
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        ((ViewGroup)sourceParent.getParent()).setClipChildren(true);
        for(int a = 0; a < ifvList.size(); a++)
            {
                if(a != sourceIndex && a != indexInListener)
                {
                    ifvList.get(a).setZ(0);
                }
            }
            source.setZ(0);
            sourceParent.setZ(0);
        }

    @Override
    public …
Run Code Online (Sandbox Code Playgroud)

android

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

Tensorflow - 如何冻结 SavedModel 中的 .pb 以用于 TensorFlowInferenceInterface 中的推理?

根据这个答案,我可以MetaGraph从 a 中提取SavedModel,然后冻结MetaGraph's GraphDef,然后在其freeze_graph.py上运行脚本GraphDef.pb在 Android 中使用。我的问题:我究竟如何提取MetaGraph(然后是它的GraphDef)?因为tf.saved_model.loader.load(sess, [tag_constants.SERVING], <model_path>)返回 aMetaGraphDef而不是 a MetaGraph

python android tensorflow

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

应用内结算-当queryPurchases()返回空列表时,Google Play会显示“您已拥有此商品”消息

我刚刚购买了一项商品,但由于Wi-Fi失效而失败,但是由于某种原因,Google Play却给我一条消息,指示订单未完成或有其他东西,我应该在某些链接上进行检查(我忘记了写下来)。

当我尝试再次进行相同的测试购买时,Google Play提示我“您已经拥有此商品”错误。所说的购买不在Google Play信息中心的我的订单历史记录中。

发生了什么事,我该如何解决?

编辑:清除Google Play商店缓存,清除Google Services Framework缓存并重新安装该应用程序不起作用。


编辑2:

我设法通过强制停止Google Play商店应用,清除其数据然后重新启动来解决此问题。目前,我只能得出结论,当Wi-Fi断开连接时进行的购买是在Play商店应用的数据中,而不是在缓存中。

因此,我的问题变成了:开发人员是否有责任处理这种特殊情况(当解决方案不在应用程序内部时),以及如何处理?

in-app-purchase in-app-billing google-play

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

MediaCodec - 将 EOS 缓冲区发送到音频解码器时出现奇怪的错误

我正在努力用另一个文件中的音乐替换我的视频的音轨。所以我修改了标准ExtractDecodeEditEncodeTest代码(来自 bigflake),以便MediaExtractor从所说的“另一个文件”创建音频。但是,当我尝试将 EOS 缓冲区发送到音频解码器时,发生了一件奇怪的事情:

this.audioDecoder.queueInputBuffer(decoderInputBufferIndex, 0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM);

这使我获得了android.media.MediaCodec$CodecException: Error 0xfffffff3.

当我在 try-catch-finally 循环中捕获它时,它显然是一个android.media.MediaCodec.error_neg_13(代码:-13)。然而,视频仍然看起来不错,替换了音轨。

据我搜索,这个错误没有任何内容,甚至在日志中也没有。有谁知道是什么导致了它以及我如何防止它发生?

android android-mediacodec

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