And it looks like, similar to the keras.preprocessing implementation, all those layers.experimental.preprocessing layers use this transform function which just takes a projection matrix:

  

      github.com
  

  
    tensorflow/tensorflow/blob/master/tensorflow/python/keras/layers/preprocessing/image_preprocessing.py#L621 3



      
      
                      array_ops.zeros((num_translations, 1), dtypes.float32),
                      -translations[:, 0, None],
                      array_ops.zeros((num_translations, 1), dtypes.float32),
                      array_ops.ones((num_translations, 1), dtypes.float32),
                      -translations[:, 1, None],
                      array_ops.zeros((num_translations, 2), dtypes.float32),
                  ],
                  axis=1)
          
          

          
def transform(images,
                        transforms,
                        fill_mode='reflect',
                        fill_value=0.0,
                        interpolation='bilinear',
                        output_shape=None,
                        name=None):
            """Applies the given transform(s) to the image(s).
          
          
  Args:
              images: A tensor of shape (num_images, num_rows, num_columns, num_channels)
      
    
  


  

  
    
    
  

  


So I think you’d just need to work out the right range of matrices there. Maybe there’s something you can copy from the keras.preprocessing version.



 Bhack:

I think we have TF native shear in the model garden package


Or maybe someone’s already done all that work.