tensorflow / tensorflow/java

Complex Tensor Implementation Missing?

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

还没有人认领这个 Issue。

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

描述

Hi everybody,

i am just simply trying to create a Complex object, and asking myself it is simply not implemented, because i do not find the Class-Type for complex64 or complex128for the Tout parameter for the "df.dtypes.complex" function. In line 5 i just used TFloat32 to get it compiled.

1 Graph g = new Graph();
2 Ops tf = Ops.create(g);
3 Constant r = tf.constant(Float.valueOf((float)5.0));
4 Constant i = tf.constant(Float.valueOf((float)3.0));
5 Complex c = tf.dtypes.complex(r,i, TFloat32.class);

I understand the problem, in line 5:

Exception in thread "main" org.tensorflow.exceptions.TFInvalidArgumentException: Value for attr 'Tout' of double is not in the list of allowed values: complex64, complex128
; NodeDef: {{node Complex}}; Op<name=Complex; signature=real:T, imag:T -> out:Tout; attr=T:type,default=DT_FLOAT,allowed=[DT_FLOAT, DT_DOUBLE]; attr=Tout:type,default=DT_COMPLEX64,allowed=[DT_COMPLEX64, DT_COMPLEX128]>
at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:87)
at org.tensorflow.GraphOperationBuilder.finish(GraphOperationBuilder.java:461)
at org.tensorflow.GraphOperationBuilder.build(GraphOperationBuilder.java:100)
at org.tensorflow.GraphOperationBuilder.build(GraphOperationBuilder.java:71)
at org.tensorflow.op.dtypes.Complex.create(Complex.java:95)
at org.tensorflow.op.DtypesOps.complex(DtypesOps.java:107)
at TensorflowTest.main(TensorflowTest.java:74)

But i do not find a ComplexDataType like TFLoat32

Can anyone bring light into my deepest darkness? I do not find a documentation or an example how it shall be done in java.

Best Regards

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 org.tensorflow.op.dtypes.Complex.java 和 org.tensorflow.op.DtypesOps.java 开始,然后将可用的 Java 数据类型类与报告中所示的 Complex 操作签名进行比较。检查现有的 Java 文档或 complex64 和 complex128 的使用示例。完成标准是提供受支持的 Java 复数类型,或记录正确使用该操作的方法。

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

评估

技术栈
java
领域
machine-learning
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

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