• Draws a tf.Tensor to a canvas.

    When the dtype of the input is 'float32', we assume values in the range [0-1]. Otherwise, when input is 'int32', we assume values in the range [0-255].

    Parameters

    • image: Tensor2D | TensorLike | Tensor3D

      The tensor to draw on the canvas. Must match one of these shapes:

      • Rank-2 with shape [height, width]: Drawn as grayscale.
      • Rank-3 with shape [height, width, 1]: Drawn as grayscale.
      • Rank-3 with shape [height, width, 3]: Drawn as RGB with alpha set in imageOptions (defaults to 1, which is opaque).
      • Rank-3 with shape [height, width, 4]: Drawn as RGBA.
    • canvas: HTMLCanvasElement

      The canvas to draw to.

    • Optionaloptions: DrawOptions

      The configuration arguments for image to be drawn and the canvas to draw to.

    Returns void