mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/31426 Tensor convertion from YUV image is moved to native with optimizations to eliminate branching inside loop, no variables declaration, less ops. Perf stat from local devices - measuring converting 320x240 image from camera to 1,3,224,224 tensor; Legend: Java - current java impl JavaOpt - current java impl + the same optimizations with no if/else in for, declare variables outside of for, inlining etc. C - C impl ``` Nexus 5 JavaOpt N:25 avg:119.24 min: 87 max:177 p10:102 p25:105 p50:115 p75:127 p90:150 C N:25 avg: 17.24 min: 14 max: 39 p10: 14 p25: 15 p50: 15 p75: 16 p90: 23 Java N:25 avg:139.96 min: 70 max:214 p10: 89 p25:110 p50:139 p75:173 p90:181 avg C vs JavaOpt 6.91x Pixel 3 XL JavaOpt N:19 avg: 16.11 min: 12 max: 19 p10: 14 p25: 15 p50: 16 p75: 18 p90: 19 C N:19 avg: 5.79 min: 3 max: 10 p10: 4 p25: 5 p50: 6 p75: 6 p90: 9 Java N:19 avg: 16.21 min: 12 max: 20 p10: 14 p25: 15 p50: 16 p75: 18 p90: 20 avg C vs JavaOpt 2.78x Full build with 4 abis inside: Pixel 3 XL JavaOpt N:25 avg: 18.84 min: 16 max: 24 p10: 16 p25: 17 p50: 18 p75: 20 p90: 22 C N:25 avg: 7.96 min: 5 max: 10 p10: 7 p25: 7 p50: 8 p75: 9 p90: 9 avg C vs JavaOpt 2.36x ``` Test Plan: Imported from OSS Differential Revision: D19165429 Pulled By: IvanKobzarev fbshipit-source-id: 3b54e545f6fbecbc5bb43216aca81061e70bd369
66 lines
1.8 KiB
Groovy
66 lines
1.8 KiB
Groovy
apply plugin: 'com.android.library'
|
|
apply plugin: 'maven'
|
|
|
|
android {
|
|
compileSdkVersion rootProject.compileSdkVersion
|
|
buildToolsVersion rootProject.buildToolsVersion
|
|
|
|
|
|
defaultConfig {
|
|
minSdkVersion rootProject.minSdkVersion
|
|
targetSdkVersion rootProject.targetSdkVersion
|
|
versionCode 0
|
|
versionName "0.1"
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
ndk {
|
|
abiFilters ABI_FILTERS.split(",")
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
minifyEnabled false
|
|
debuggable true
|
|
}
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
path "CMakeLists.txt"
|
|
}
|
|
}
|
|
|
|
useLibrary 'android.test.runner'
|
|
useLibrary 'android.test.base'
|
|
useLibrary 'android.test.mock'
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':pytorch_android')
|
|
|
|
implementation 'com.android.support:appcompat-v7:' + rootProject.androidSupportAppCompatV7Version
|
|
implementation 'com.facebook.soloader:nativeloader:' + rootProject.soLoaderNativeLoaderVersion
|
|
|
|
testImplementation 'junit:junit:' + rootProject.junitVersion
|
|
testImplementation 'androidx.test:core:' + rootProject.coreVersion
|
|
|
|
androidTestImplementation 'junit:junit:' + rootProject.junitVersion
|
|
androidTestImplementation 'androidx.test:core:' + rootProject.coreVersion
|
|
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
|
|
androidTestImplementation 'androidx.test:rules:' + rootProject.rulesVersion
|
|
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion
|
|
}
|
|
|
|
apply from: rootProject.file('gradle/release.gradle')
|
|
|
|
task sourcesJar(type: Jar) {
|
|
from android.sourceSets.main.java.srcDirs
|
|
classifier = 'sources'
|
|
}
|
|
|
|
artifacts.add('archives', sourcesJar)
|