Decode a PNG-encoded image to a uint8 or uint16 tensor. The attr `channels` indicates the desired number of color channels for the decoded image. Accepted values are: * 0: Use the number of channels in the PNG-encoded image. * 1: output a grayscale image. * 3: output an RGB image. * 4: ou
(scope *Scope, contents tf.Output, optional ...DecodePngAttr)
| 37654 | // |
| 37655 | // Returns 3-D with shape `[height, width, channels]`. |
| 37656 | func DecodePng(scope *Scope, contents tf.Output, optional ...DecodePngAttr) (image tf.Output) { |
| 37657 | if scope.Err() != nil { |
| 37658 | return |
| 37659 | } |
| 37660 | attrs := map[string]interface{}{} |
| 37661 | for _, a := range optional { |
| 37662 | a(attrs) |
| 37663 | } |
| 37664 | opspec := tf.OpSpec{ |
| 37665 | Type: "DecodePng", |
| 37666 | Input: []tf.Input{ |
| 37667 | contents, |
| 37668 | }, |
| 37669 | Attrs: attrs, |
| 37670 | } |
| 37671 | op := scope.AddOperation(opspec) |
| 37672 | return op.Output(0) |
| 37673 | } |
| 37674 | |
| 37675 | // AssertAttr is an optional argument to Assert. |
| 37676 | type AssertAttr func(optionalAttr) |
no test coverage detected