a30c31849a1ce6791ad201f09507c2f2dfe6db27,tensorflow_datasets/core/features/image_feature.py,Image,encode_sample,#Image#Any#,103

Before Change


      raise ValueError("Could not convert {} to image".format(image_or_path))

    // Check that the image is valid
    if np_image.dtype != np.uint8:
      raise ValueError("Image should be uint8. Detected: {}".format(
          np_image.dtype))
    utils.assert_shape_match(np_image.shape, self._shape)

    // TODO(epot): Should support additional format
    image_format = "png"

After Change


    if isinstance(image_or_path, np.ndarray):
      encoded_image = self._encode_image(image_or_path)
    else:
      with tf.gfile.Open(image_or_path, "rb") as image_f:
        encoded_image = image_f.read()
    return encoded_image
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: tensorflow/datasets
Commit Name: a30c31849a1ce6791ad201f09507c2f2dfe6db27
Time: 2018-11-08
Author: pierrot@google.com
File Name: tensorflow_datasets/core/features/image_feature.py
Class Name: Image
Method Name: encode_sample


Project Name: googledatalab/pydatalab
Commit Name: 5ad187bca1c975d7cc030c5eac8139df51677efa
Time: 2017-03-23
Author: brandondutra@google.com
File Name: google/datalab/ml/_util.py
Class Name:
Method Name: open_local_or_gcs


Project Name: tensorflow/mesh
Commit Name: 781873c42413d3728e15357eed9de03acc27c66a
Time: 2019-03-08
Author: noam@google.com
File Name: examples/transformer_standalone.py
Class Name:
Method Name: decode_from_file