Cast x of type SrcT to y of DstT.
(scope *Scope, x tf.Output, DstT tf.DataType, optional ...CastAttr)
| 31816 | |
| 31817 | // Cast x of type SrcT to y of DstT. |
| 31818 | func Cast(scope *Scope, x tf.Output, DstT tf.DataType, optional ...CastAttr) (y tf.Output) { |
| 31819 | if scope.Err() != nil { |
| 31820 | return |
| 31821 | } |
| 31822 | attrs := map[string]interface{}{"DstT": DstT} |
| 31823 | for _, a := range optional { |
| 31824 | a(attrs) |
| 31825 | } |
| 31826 | opspec := tf.OpSpec{ |
| 31827 | Type: "Cast", |
| 31828 | Input: []tf.Input{ |
| 31829 | x, |
| 31830 | }, |
| 31831 | Attrs: attrs, |
| 31832 | } |
| 31833 | op := scope.AddOperation(opspec) |
| 31834 | return op.Output(0) |
| 31835 | } |
| 31836 | |
| 31837 | // StatelessTruncatedNormalAttr is an optional argument to StatelessTruncatedNormal. |
| 31838 | type StatelessTruncatedNormalAttr func(optionalAttr) |