1

有什么方法可以抑制layer_dense()R 包的功能生成的输出keras?以下四种变体中的任何一种都会在第一次调用时导致以下输出layer_dense(),我想避免这种情况:

2020-12-25 22:52:32.777776: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-12-25 22:52:32.792832: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f9ca7099490 executing computations on platform Host. Devices:
2020-12-25 22:52:32.792853: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version

一些试验:

library(keras)
in.lay <- layer_input(shape = 2)
capture.output(out.lay <- layer_dense(in.lay, units = 2))
q()

library(keras)
in.lay <- layer_input(shape = 2)
suppressWarnings(out.lay <- layer_dense(in.lay, units = 2))
q()

library(keras)
in.lay <- layer_input(shape = 2)
suppressMessages(out.lay <- layer_dense(in.lay, units = 2))
q()

library(keras)
in.lay <- layer_input(shape = 2)
suppressPackageStartupMessages(out.lay <- layer_dense(in.lay, units = 2))
q()

是相关的,但上述情况似乎更难解决。

4

1 回答 1

1

虽然它一般不能解决问题(但我想尝试过的解决方案应该会起作用),但我现在在这里找到了这个特定问题的解决方案,并这里做了一些解释。简而言之,调用会避开消息(并且有 0、1、2、3 级别可供选择)。Sys.setenv(TF_CPP_MIN_LOG_LEVEL = "1")

于 2020-12-26T19:10:14.553 回答