class_docstr: A subclass of :class:`~ffcv.fields.Field` supporting
  multi-dimensional fixed size matrices of any numpy type.
class_docstr_tok: ["A","subclass","of",":","class",":","`","~ffcv.fields.Field","`","supporting","multi-dimensional","fixed","size","matrices","of","any","numpy","type","."]
code: def to_binary(self) -> ARG_TYPE:
      result = np.zeros(1, dtype=ARG_TYPE)[0]
      header = np.zeros(1, dtype=NDArrayArgsType)
      s = np.array(self.shape).astype("<u8")
      header["shape"][0][: len(s)] = s
      encoded_type = json.dumps(self.dtype.descr)
      encoded_type = np.frombuffer(
          encoded_type.encode("ascii"), dtype="<u1"
      )
      header["type_length"][0] = len(encoded_type)
      to_write = np.concatenate([header.view("<u1"), encoded_type])
      result[0][: to_write.shape[0]] = to_write
      return result
  
imports: from typing import Callable, TYPE_CHECKING, Tuple, Type
  import warnings
  import json
  from dataclasses import replace
  import numpy
  import torch
  from .base import Field, ARG_TYPE
  from ..pipeline.operation import Operation
  from ..pipeline.state import State
  from ..pipeline.compiler import Compiler
  from ..pipeline.allocation_query import AllocationQuery
  from ..libffcv import memcpy
label_desc: Use image node_id 4 for calling the NDArrayField obj's underlying member method code with example usage: obj.to_binary() and returns: result