小编Tap*_*pio的帖子

Tensorflow Keras model.summary() 在层上显示 0 个可训练参数

我正在训练 LSTM 变体 PhasedLSTM 以进行回归。我正在使用 tensorflow.contrib.rnn.PhasedLSTMCell ,除了功能之外,它还需要一个时间戳向量。这是我的模型定义:

    from tensorflow.keras.layers import Dense, RNN, Input
    from tensorflow.keras.models import Model
    from tensorflow.keras.optimizers import Adam

    from tensorflow.contrib.rnn import PhasedLSTMCell

    hidden_size = 128
    num_features = 217
    num_timesteps = 2016

    input_layer_timestamps = Input(shape=(num_timesteps, 1), name='time_input')
    input_layer_features = Input(shape=(num_timesteps, num_features) name='data_input')

    timed_inputs = (input_layer_timestamps, input_layer_features)

    P_cell = PhasedLSTMCell(hidden_size)
    PLSTM_layer = RNN(P_cell, return_sequences=False, name='Phased_LSTM_1')(timed_inputs)

    output_layer = Dense(2, activation=None)(PLSTM_layer_1)

    model = Model(inputs  = [input_layer_timestamps, input_layer_features],
                  outputs = [output_layer])

    lstm_optimizer = Adam(lr=Adam_lr, clipnorm=5.)

    model.compile(optimizer=lstm_optimizer,
                  loss='mse')

    model.summary()
Run Code Online (Sandbox Code Playgroud)

该模型可以很好地编译和训练。验证结果似乎不错,但存在合理的错误。但是,上一个片段中 model.summary() 的输出是:

__________________________________________________________________________________________________ …
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow tf.keras

7
推荐指数
0
解决办法
1843
查看次数

如何替换已弃用的 aws ecr get-login --registry-ids

我正在尝试按照此示例提取 Amazon SageMaker Pytorch 公共映像之一。在示例中,他们使用 shell 脚本和 Dockerfile 来拉取扩展构建容器并将其推送到 ECR。这是 shell 脚本:

# The name of our algorithm
algorithm_name=pytorch-extending-our-containers-cifar10-example

cd container

account=$(aws sts get-caller-identity --query Account --output text)

# Get the region defined in the current configuration (default to us-west-2 if none defined)
region=$(aws configure get region)
region=${region:-us-west-2}

fullname="${account}.dkr.ecr.${region}.amazonaws.com/${algorithm_name}:latest"

# If the repository doesn't exist in ECR, create it.

aws ecr describe-repositories --repository-names "${algorithm_name}" > /dev/null 2>&1

if [ $? -ne 0 ]
then
    aws ecr create-repository --repository-name …
Run Code Online (Sandbox Code Playgroud)

docker aws-cli amazon-ecr

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

标签 统计

amazon-ecr ×1

aws-cli ×1

docker ×1

keras ×1

python ×1

tensorflow ×1

tf.keras ×1