class_docstr: Image encoder of float32.
  
  Wrapper around `_ImageEncoder` which bitcast 1-channel float32 image
  into 4-channels uint8, so image can be encoded to PNG.
class_docstr_tok: ["Image","encoder","of","float32",".","Wrapper","around","`","_ImageEncoder","`","which","bitcast","1-channel","float32","image","into","4-channels","uint8",",","so","image","can","be","encoded","to","PNG","."]
code: def __init__(
      self,
      *,
      shape: utils.Shape,
      encoding_format: str,
  ):
      # Assert that shape and encoding are valid when dtype==tf.float32.
      if shape[-1] != 1:
          raise ValueError(
              "tfds.features.Image only support single-channel for tf.float32. "
              f"Got shape={shape}"
          )
      if encoding_format and encoding_format != "png":
          raise ValueError(
              "tfds.features.Image only support PNG encoding for tf.float32"
          )
      self._float_shape = shape
      super().__init__(
          shape=shape[:2] + (4,),
          dtype=np.uint8,
          encoding_format=encoding_format,
      )
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import io
  import os
  import tempfile
  from typing import Any, List, Optional, Type, Union
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import dtype_utils
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 1 to create a new _FloatImageEncoder object from inherited base classes: _ImageEncoder with example: obj = _FloatImageEncoder()