Issue 1:
🐛 Bug

PyTorch Java Native Interface is conflicting with React Native one. (they both use fbjni with a slightly different version).

This cause issue during the android build in an React Native project:

java.lang.RuntimeException: Duplicate class com.facebook.jni.CppException found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.CppSystemErrorException found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread$1 found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread$Destructor found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread$DestructorList found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread$DestructorStack found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.DestructorThread$Terminus found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.HybridClassBase found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.HybridData found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.HybridData$Destructor found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.IteratorHelper found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.MapIteratorHelper found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.NativeRunnable found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.ThreadScopeSupport found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

Duplicate class com.facebook.jni.UnknownCppException found in modules fbjni-java-only-0.0.3.jar (com.facebook.fbjni:fbjni-java-only:0.0.3) and pytorch_android_fbjni-1.4.0-runtime.jar (org.pytorch:pytorch_android_fbjni:1.4.0)

To Reproduce

Steps to reproduce the behavior:

Create a new React Native project using the CLI: npx react-native init AwesomeProject

Add the PyTorch android dependencies:

implementation 'org.pytorch:pytorch_android:1.4.0'

implementation 'org.pytorch:pytorch_android_torchvision:1.4.0'

Change the minSdkVersion to 21 in the root android/build.gradle

Sync gradle and build the android app

Expected behavior

The Application should be able to build without having "duplicate class" issue and start on the device

Environment

➜ python collect_env.py

Collecting environment information...

PyTorch version: N/A - 1.4.0

Is debug build: N/A

CUDA used to build PyTorch: N/A

OS: Mac OSX 10.15.5 (x86_64)

GCC version: Could not collect

Clang version: 11.0.3 (clang-1103.0.32.62)

CMake version: Could not collect

Python version: 2.7 (64-bit runtime)

Is CUDA available: N/A

CUDA runtime version: Could not collect

GPU models and configuration: Could not collect

Nvidia driver version: Could not collect

cuDNN version: Could not collect

Versions of relevant libraries:

[pip] numpy==1.8.0rc1

[conda] Could not collect

Additional context

There were some talk on the PyTorch forum here saying that someone (from PyTorch team?) was discussing with the RN Team, but there is no update since March 20 AND the issue come after the reported issue here.

Issue 2:
📚 Documentation

I am a fan of pytorch in China.

The purpose of our visit is very simple, apply for translation of the Chinese version, I hope to get the relevant authorization!

(Sorry: the official website did not find your email)

There are several reasons:

The English level of many Chinese users is not very good.

Network problems, you know (China's magic network)!

Online blogs are very messy.

We are ApacheCN, China's open source small organization, and hope to do some translation to help more people learn, our website: http://www.apachecn.org

We have previously translated pytorch: https://pytorch.apachecn.org

If you like, we will continue to help translate the Chinese version of pytorch.