# Path: pysc2/lib/image_differencer.py
# def image_differencer(path, proto_a, proto_b):
#   """proto_diff differencer for PySC2 image data."""
#   if path[-1] == "data" and len(path) >= 2:
#     image_data_path = proto_diff.ProtoPath(path[:-1])
#     image_data_a = image_data_path.get_field(proto_a)
#     if isinstance(image_data_a, common_pb2.ImageData):
#       image_data_b = image_data_path.get_field(proto_b)
#       image_a = features.Feature.unpack_layer(image_data_a)
#       image_b = features.Feature.unpack_layer(image_data_b)
#       return np_util.summarize_array_diffs(image_a, image_b)
# 
#   return None
# 
# Path: pysc2/lib/proto_diff.py
# _ARRAY_PLACEHOLDER = "*"
# class ProtoPath(object):
# class ProtoDiffs(object):
#   def __init__(self, path):
#   def get_field(self, proto):
#   def with_anonymous_array_indices(self):
#   def path(self):
#   def __lt__(self, other):
#   def __getitem__(self, item):
#   def __len__(self):
#   def __eq__(self, o):
#   def __hash__(self):
#   def __repr__(self):
#   def __init__(self, proto_a, proto_b, changed, added, removed):
#   def proto_a(self):
#   def proto_b(self):
#   def changed(self):
#   def added(self):
#   def removed(self):
#   def all_diffs(self):
#   def report(self, differencers=None, truncate_to=0):
#   def __repr__(self):
# def _truncate(val, truncate_to):
# def _dict_path_to_proto_path(dict_path):
# def compute_diff(proto_a, proto_b):


from absl.testing import absltest
from pysc2.lib import image_differencer
from pysc2.lib import proto_diff
from s2clientprotocol import common_pb2
from s2clientprotocol import sc2api_pb2 as sc_pb
from s2clientprotocol import spatial_pb2
import numpy as np
    a = sc_pb.ResponseObservation(
        observation=sc_pb.Observation(
            feature_layer_data=spatial_pb2.ObservationFeatureLayer(
                renders=spatial_pb2.FeatureLayers(
                    height_map=common_pb2.ImageData(
                        bits_per_pixel=32,
                        size=common_pb2.Size2DI(x=4, y=4),
                        data=np.array([[0, 0, 0, 0],
                                       [1, 0, 1, 0],
                                       [0, 0, 0, 1],
                                       [1, 1, 1, 1]], dtype=np.int32).tobytes()
                    )
                )
            )))
    b = sc_pb.ResponseObservation(
        observation=sc_pb.Observation(
            feature_layer_data=spatial_pb2.ObservationFeatureLayer(
                renders=spatial_pb2.FeatureLayers(
                    height_map=common_pb2.ImageData(
                        bits_per_pixel=32,
                        size=common_pb2.Size2DI(x=4, y=4),
                        data=np.array([[0, 0, 0, 0],
                                       [0, 1, 1, 0],
                                       [0, 0, 0, 1],
                                       [1, 1, 1, 0]], dtype=np.int32).tobytes()
                    )
                )
            )))

    result = image_differencer.image_differencer(

# Path: pysc2/lib/image_differencer.py
# def image_differencer(path, proto_a, proto_b):
#   """proto_diff differencer for PySC2 image data."""
#   if path[-1] == "data" and len(path) >= 2:
#     image_data_path = proto_diff.ProtoPath(path[:-1])
#     image_data_a = image_data_path.get_field(proto_a)
#     if isinstance(image_data_a, common_pb2.ImageData):
#       image_data_b = image_data_path.get_field(proto_b)
#       image_a = features.Feature.unpack_layer(image_data_a)
#       image_b = features.Feature.unpack_layer(image_data_b)
#       return np_util.summarize_array_diffs(image_a, image_b)
# 
#   return None
# 
# Path: pysc2/lib/proto_diff.py
# _ARRAY_PLACEHOLDER = "*"
# class ProtoPath(object):
# class ProtoDiffs(object):
#   def __init__(self, path):
#   def get_field(self, proto):
#   def with_anonymous_array_indices(self):
#   def path(self):
#   def __lt__(self, other):
#   def __getitem__(self, item):
#   def __len__(self):
#   def __eq__(self, o):
#   def __hash__(self):
#   def __repr__(self):
#   def __init__(self, proto_a, proto_b, changed, added, removed):
#   def proto_a(self):
#   def proto_b(self):
#   def changed(self):
#   def added(self):
#   def removed(self):
#   def all_diffs(self):
#   def report(self, differencers=None, truncate_to=0):
#   def __repr__(self):
# def _truncate(val, truncate_to):
# def _dict_path_to_proto_path(dict_path):
# def compute_diff(proto_a, proto_b):


# Path: pysc2/lib/image_differencer_test.py
from absl.testing import absltest
from pysc2.lib import image_differencer
from pysc2.lib import proto_diff
from s2clientprotocol import common_pb2
from s2clientprotocol import sc2api_pb2 as sc_pb
from s2clientprotocol import spatial_pb2
import numpy as np

    a = sc_pb.ResponseObservation(
        observation=sc_pb.Observation(
            feature_layer_data=spatial_pb2.ObservationFeatureLayer(
                renders=spatial_pb2.FeatureLayers(
                    height_map=common_pb2.ImageData(
                        bits_per_pixel=32,
                        size=common_pb2.Size2DI(x=4, y=4),
                        data=np.array([[0, 0, 0, 0],
                                       [1, 0, 1, 0],
                                       [0, 0, 0, 1],
                                       [1, 1, 1, 1]], dtype=np.int32).tobytes()
                    )
                )
            )))
    b = sc_pb.ResponseObservation(
        observation=sc_pb.Observation(
            feature_layer_data=spatial_pb2.ObservationFeatureLayer(
                renders=spatial_pb2.FeatureLayers(
                    height_map=common_pb2.ImageData(
                        bits_per_pixel=32,
                        size=common_pb2.Size2DI(x=4, y=4),
                        data=np.array([[0, 0, 0, 0],
                                       [0, 1, 1, 0],
                                       [0, 0, 0, 1],
                                       [1, 1, 1, 0]], dtype=np.int32).tobytes()
                    )
                )
            )))

    result = image_differencer.image_differencer(

        path=proto_diff.ProtoPath((