python - 用于不规则张量占位符的 R Keras 功能 API 方法?
问题描述
在 python 中,我可以实例化一个参差不齐的张量占位符,如下所示。
inputs_1 = keras.Input(shape=[None,], dtype='int64', ragged=True, name = 'message_A')
inputs_1
tf.RaggedTensor(values=Tensor("Placeholder:0", shape=(None,), dtype=int64), row_splits=Tensor("Placeholder_1:0", shape=(None,), dtype=int64))
Tensorflow responds that the placeholder is ragged with a shape=(None,). But using R-Keras & R-Tensorflow its seems I cannot do the same. I can request an input placeholder and the parameter to make it ragged exists but the response suggests it is not in fact ragged. Additionally, you are forced to declare some shape rather than keep the shape 'flexible' for the ragged tensor.
inputs_1 = tf$keras$Input(shape=c(100L), ragged = TRUE)
inputs_1
Tensor("Placeholder:0", shape=(None, 100), dtype=float32)
你能告诉我如何使用 R-Keras 或 R-Tensorflow 创建一个参差不齐的张量占位符吗?
解决方案
推荐阅读
- reactjs - 设定值
通过福米克 使用自定义组件 - python - 在 PyCrypto 中验证 RSA 签名 - 输入格式
- javascript - 无法使用 npx create-react-app 创建反应应用程序
- javascript - 使用 Redux 调度操作获取 TS 错误,“类型上不存在属性”
- node.js - 无法从其他容器或主机访问带有 nodejs 应用程序(NestJS)的 Docker 容器
- amazon-dynamodb - DynamoDB 中的 `KeyConditionExpression` 是否支持 `IN` 运算符?
- ruby-on-rails - 在不支持的 mac 上安装 rails
- linux - 尝试检查文件的校验和是否已更改时,出现错误“没有名为 file.yaml 的服务”
- php - 如何解析单个数据以查看 laravel?
- .net - 在 .NET 中,如何为 OLE 分配的以 0 结尾的非托管 Unicode 字符串释放内存?