8000 [BUG Report]: 使用Lstm同样的代码,再python正常运行,但是使用.net报错 · Issue #1293 · SciSharp/TensorFlow.NET · GitHub
[go: up one dir, main page]

Skip to content 8000
[BUG Report]: 使用Lstm同样的代码,再python正常运行,但是使用.net报错 #1293
Open
@xdaker

Description

@xdaker

Description

python代码:
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers

inputs = tf.random.normal([32, 10, 8])
lstm = tf.keras.layers.LSTM(4)
output = lstm(inputs)
print(output.shape)
#(32, 4)
lstm = tf.keras.layers.LSTM(4, return_sequences=True, return_state=True)
whole_seq_output, final_memory_state, final_carry_state = lstm(inputs)
print(whole_seq_output.shape)
#(32, 10, 4)
print(final_memory_state.shape)
#(32, 4)
print(final_carry_state.shape)
#(32, 4)

C#代码:
var inputs = tf.random.normal(new Shape(32, 10, 8));
var lstm = new Tensorflow.Keras.Layers.LSTM(new LSTMArgs()
{
Units = 4,
//InputShape = new Shape(10,8)
});
var y = lstm.Apply(inputs);//在这个位置报错,提示索引超出范围
print(y.shape);

Reproduction Steps

No response

Known Workarounds

无解决办法
No response

Configuration and Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0