tensorflow / tensorflow/java

Tensor.tensorOf methods can return unzeroed memory

未关闭
#271 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
928
派生
227
PR 合并指标
30 天内没有已合并 PR

描述

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yep
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 0.3.1

Describe the current behavior

Tensor.of(Class,Shape,long) and Tensor.of(Class,Shape) return a Tensor which has not been zeroed. This is used by the various tensorOf methods on things like TFloat32.

Describe the expected behavior

Tensors should be initialised to be all zero the same way any other Java object is.

Code to reproduce the issue

Run TFloat32.tensorOf(Shape.of(2,2)) and you'll likely get some junk in there. I was allocating things (16,10) but the size is irrelevant.

I was building a one hot vector to use as the target for a training run, and I expected to get an all zero tensor back, so I only set the 1s. The model was very confused by the true labels having NaNs in.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Tensor.of(Class, Shape, long) 和 Tensor.of(Class, Shape) 开始,然后使用 TFloat32.tensorOf(Shape.of(2,2)) 重现该问题。确认新创建的张量只包含零,包括通过相关 tensorOf 方法创建的张量;如果周围的代码提供了回归检查,则添加或运行该检查。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
machine-learning
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。