Repository: kornia/kornia

Issue:
Enabled RandomResizedCrop batch mode when same_on_batch=False
### Description

#680

The previous implementation would crop the same size then resize. This PR enabled different cropped sizes across the batch.

<img width="1028" alt="Screenshot 2020-09-15 at 11 18 54 PM" src="https://user-images.githubusercontent.com/15955486/93230317-1f4f1980-f7aa-11ea-9f07-bb85c2bab50f.png">



### Status
**Ready/Work in progress/Hold**

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not applicable items -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or new feature that would cause existing functionality to change)
- [ ] New tests added to cover the changes
- [ ] Docstrings/Documentation updated


## PR Checklist
### PR Implementer
This is a small checklist for the implementation details of this PR.

If there are any questions regarding code style or other conventions check out our 
[summary](https://github.com/kornia/kornia/blob/master/CONTRIBUTING.rst).

- [ ] Did you discuss the functionality or any breaking changes before ?
- [ ] **Pass all tests**: did you test in local ? `make test`
- [ ] Unittests: did you add tests for your new functionality ?
- [ ] Documentations: did you build documentation ? `make build-docs`
- [ ] Implementation: is your code well commented and follow conventions ? `make lint`
- [ ] Docstrings & Typing: has your code documentation and typing ? `make mypy`
- [ ] Update notebooks & documentation if necessary

### KorniaTeam
<details>
  <summary>KorniaTeam workflow</summary>
  
  - [ ] Assign correct label
  - [ ] Assign PR to a reviewer
  - [ ] Does this PR close an Issue? (add `closes #IssueNumber` at the bottom if 
        not already in description)

</details>

### Reviewer
<details>
  <summary>Reviewer workflow</summary>

  - [ ] Do all tests pass? (Unittests, Typing, Linting, Documentation, Environment)
  - [ ] Does the implementation follow `kornia` design conventions?
  - [ ] Is the documentation complete enough ?
  - [ ] Are the tests covering simple and corner cases ?
 
</details>



Discussion:
@edgarriba It seems like ```test_essential.TestEssentialFromFundamental.test_from_to_fundamental``` will not always output similar outputs in different seeds.

I run the tests twice and this function failed twice with different outputs (the last time diff is 0.001 and this time is 0.004). Is it expected or we should somehow fix it?
@shijianjian Tweaking the test tolerance might fix it. I will investigate in detail the issue. Can you open an issue in the meantime ?

Resolving patch:
diff --git a/kornia/geometry/homography.py b/kornia/geometry/homography.py
--- a/kornia/geometry/homography.py
+++ b/kornia/geometry/homography.py
@@ -47,7 +47,7 @@ def find_homography_dlt(
     else:
         # We should use provided weights
         assert len(weights.shape) == 2 and weights.shape == points1.shape[:2], weights.shape
-        w_diag = torch.diag_embed(weights.repeat(1, 2))
+        w_diag = torch.diag_embed(weights.unsqueeze(dim=-1).repeat(1, 1, 2).reshape(weights.shape[0], -1))
         A = A.transpose(-2, -1) @ w_diag @ A
 
     try:


Test patch: