部署独立容器时,我可以使用自定义选项将 /dev/shm 挂载为 tmpfs,如下所示:
docker run --name my-container -v /dev/shm --tmpfs /dev/shm:rw,nosuid,nodev,exec,size=90g my-image
Run Code Online (Sandbox Code Playgroud)
但是,在使用docker stack deploy. 此处的文档中似乎没有任何相关信息。与以下docker-compose.yml
version: '3.6'
services:
master:
image: "my-image"
ports:
- "8080:8080"
volumes:
- type: tmpfs
target: /dev/shm
Run Code Online (Sandbox Code Playgroud)
/dev/shm使用默认选项安装。如何使用/dev/shm选项安装?(rw,nosuid,nodev,exec,size=90g)docker stack deploy
我正在使用 TensorFlow Dataset API 来解析 CSV 文件并运行逻辑回归。我下面从TF文件的例子在这里。
以下代码片段显示了我如何设置模型:
def input_fn(path, num_epochs, batch_size):
dataset = tf.data.TextLineDataset(path)
dataset = dataset.map(parse_table, num_parallel_calls=12)
dataset = dataset.repeat(num_epochs)
dataset.batch(batch_size)
iterator = dataset.make_one_shot_iterator()
features, labels = iterator.get_next()
return features, labels
def parse_table(value):
cols = tf.decode_csv(value, record_defaults=TAB_COLUMN_DEFAULTS)
indep_vars = dict(zip(CSV_COLS, cols))
y = indep_vars.pop('y')
return indep_vars, y
def build_indep_vars():
continuous_vars = [
tf.feature_column.numeric_column(x, shape=1) for x in CONT_COLS]
categorical_vars = [
tf.feature_column.categorical_column_with_hash_bucket(
x, hash_bucket_size=100) for x in CAT_COLS]
return categorical_vars + continuous_vars
Run Code Online (Sandbox Code Playgroud)
调用时lr.train(input_fn = lambda: …