Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Commit b1c1fdf

Browse files
author
Nikhil Thorat
authored
Add 80 chars lint rule, fix lint errors, and silence the linter where we have imports > 80. (#36)
* Add 80 chars lint rule, fix lint errors, and silence the linter where we have imports > 80. * add line length silence to intro.ts
1 parent 2db9024 commit b1c1fdf

23 files changed

+84
-42
lines changed

demos/benchmarks/math-benchmark-run-groups.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import * as mulmat_gpu_benchmark from './mulmat_gpu_benchmark';
2525
export const BENCHMARK_RUN_GROUPS: BenchmarkRunGroup[] = [
2626
{
2727
name:
28-
'Matrix Multiplication (CPU vs GPU): matmul([size, size], [size, size])',
28+
'Matrix Multiplication (CPU vs GPU): ' +
29+
'matmul([size, size], [size, size])',
2930
min: 0,
3031
max: 1024,
3132
stepSize: 64,
@@ -70,7 +71,8 @@ export const BENCHMARK_RUN_GROUPS: BenchmarkRunGroup[] = [
7071
stepSize: 64,
7172
stepToSizeTransformation: (step: number) => Math.max(1, step),
7273
benchmarkRuns: [
73-
new BenchmarkRun('logsumexp_gpu', logsumexp_gpu_benchmark.BENCHMARK_TEST),
74+
new BenchmarkRun(
75+
'logsumexp_gpu', logsumexp_gpu_benchmark.BENCHMARK_TEST),
7476
new BenchmarkRun('logsumexp_cpu', logsumexp_cpu_benchmark.BENCHMARK_TEST)
7577
],
7678
}

demos/benchmarks/max_pool_backprop_gpu_benchmark.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515

1616
import * as conv_util from '../../src/math/conv_util';
1717
import {GPGPUContext} from '../../src/math/webgl/gpgpu_context';
18+
// tslint:disable-next-line:max-line-length
1819
import * as max_pool_backprop_gpu from '../../src/math/webgl/max_pool_backprop_gpu';
1920
import * as test_util from '../../src/test_util';
2021
import * as util from '../../src/util';
@@ -79,4 +80,4 @@ export const BENCHMARK_TEST: BenchmarkTest = (size: number) => {
7980
gpgpu.dispose();
8081

8182
return avgTime;
82-
};
83+
};

demos/homepage/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function isSafari() {
3030
function isMobile() {
3131
// tslint:disable-next-line:no-any
3232
const a = navigator.userAgent||navigator.vendor||(window as any).opera;
33+
// tslint:disable-next-line:max-line-length
3334
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4));
3435
}
3536

demos/imagenet/imagenet-demo.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ limitations under the License.
1515

1616
import '../demo-header';
1717
import '../demo-footer';
18+
// tslint:disable-next-line:max-line-length
1819
import {gpgpu_util, GPGPUContext, NDArrayMathCPU, NDArrayMathGPU} from '../deeplearnjs';
1920
import * as imagenet_util from '../models/imagenet_util';
2021
import {SqueezeNet} from '../models/squeezenet';
2122
import {PolymerElement, PolymerHTMLElement} from '../polymer-spec';
2223

2324
// tslint:disable-next-line:variable-name
24-
export const ImagenetDemoPolymer: new () => PolymerHTMLElement = PolymerElement({
25-
is: 'imagenet-demo',
26-
properties: {
27-
layerNames: Array,
28-
selectedLayerName: String,
29-
inputNames: Array,
30-
selectedInputName: String
31-
}
32-
});
25+
export const ImagenetDemoPolymer: new () => PolymerHTMLElement =
26+
PolymerElement({
27+
is: 'imagenet-demo',
28+
properties: {
29+
layerNames: Array,
30+
selectedLayerName: String,
31+
inputNames: Array,
32+
selectedInputName: String
33+
}
34+
});
3335

3436
/**
3537
* NOTE: To use the webcam without SSL, use the chrome flag:

demos/intro/intro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
15+
// tslint:disable-next-line:max-line-length
1616
import {NDArrayMathGPU, Scalar, Array1D, Array2D, Graph, Session, SGDOptimizer, InCPUMemoryShuffledInputProviderBuilder, FeedEntry, CostReduction} from '../deeplearnjs';
1717

1818
// This file parallels (some of) the code in the introduction tutorial.

demos/mnist/mnist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
15+
// tslint:disable-next-line:max-line-length
1616
import {Array1D, Array2D, CheckpointLoader, Graph, NDArray, NDArrayInitializer, NDArrayMath, NDArrayMathGPU, Scalar, Session, Tensor} from '../deeplearnjs';
1717

1818
// manifest.json lives in the same directory as the mnist demo.

demos/model-builder/layer_builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
15+
// tslint:disable-next-line:max-line-length
1616
import {Array1D, Array2D, Array4D, conv_util, Graph, Initializer, NDArray, NDArrayInitializer, Tensor, util, VarianceScalingInitializer, ZerosInitializer} from '../deeplearnjs';
1717

1818
/**

demos/model-builder/model-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import '../demo-header';
2020
import '../demo-footer';
2121

2222
import {PolymerElement, PolymerHTMLElement} from '../polymer-spec';
23-
23+
// tslint:disable-next-line:max-line-length
2424
import {Array1D, Array3D, DataStats, FeedEntry, Graph, GraphRunner, GraphRunnerEventObserver, InCPUMemoryShuffledInputProviderBuilder, InMemoryDataset, MetricReduction, NDArray, NDArrayMath, NDArrayMathCPU, NDArrayMathGPU, Optimizer, Scalar, Session, SGDOptimizer, Tensor, util} from '../deeplearnjs';
2525
import {NDArrayImageVisualizer} from '../ndarray-image-visualizer';
2626
import {NDArrayLogitsVisualizer} from '../ndarray-logits-visualizer';

demos/model-builder/tensorflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
// tslint:disable-next-line:max-line-length
1617
import {Convolution2DLayerBuilder, LayerBuilder, MaxPoolLayerBuilder} from './layer_builder';
1718

1819
export enum Normalization {

demos/models/imagenet_classes.ts

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ limitations under the License.
1616
export const IMAGENET_CLASSES: {[key: number]: string} = {
1717
0: 'tench, Tinca tinca',
1818
1: 'goldfish, Carassius auratus',
19-
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
19+
2: 'great white shark, white shark, man-eater, man-eating shark, ' +
20+
'Carcharodon carcharias',
2021
3: 'tiger shark, Galeocerdo cuvieri',
2122
4: 'hammerhead, hammerhead shark',
2223
5: 'electric ray, crampfish, numbfish, torpedo',
@@ -62,7 +63,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
6263
45: 'Gila monster, Heloderma suspectum',
6364
46: 'green lizard, Lacerta viridis',
6465
47: 'African chameleon, Chamaeleo chamaeleon',
65-
48: 'Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis',
66+
48: 'Komodo dragon, Komodo lizard, dragon lizard, giant lizard, ' +
67+
'Varanus komodoensis',
6668
49: 'African crocodile, Nile crocodile, Crocodylus niloticus',
6769
50: 'American alligator, Alligator mississipiensis',
6870
51: 'triceratops',
@@ -118,7 +120,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
118120
101: 'tusker',
119121
102: 'echidna, spiny anteater, anteater',
120122
103:
121-
'platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus',
123+
'platypus, duckbill, duckbilled platypus, duck-billed platypus, ' +
124+
'Ornithorhynchus anatinus',
122125
104: 'wallaby, brush kangaroo',
123126
105: 'koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus',
124127
106: 'wombat',
@@ -137,10 +140,12 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
137140
119: 'rock crab, Cancer irroratus',
138141
120: 'fiddler crab',
139142
121:
140-
'king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica',
143+
'king crab, Alaska crab, Alaskan king crab, Alaska king crab, ' +
144+
'Paralithodes camtschatica',
141145
122: 'American lobster, Northern lobster, Maine lobster, Homarus americanus',
142146
123:
143-
'spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish',
147+
'spiny lobster, langouste, rock lobster, crawfish, crayfish, sea ' +
148+
'crawfish',
144149
124: 'crayfish, crawfish, crawdad, crawdaddy',
145150
125: 'hermit crab',
146151
126: 'isopod',
@@ -165,7 +170,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
165170
145: 'king penguin, Aptenodytes patagonica',
166171
146: 'albatross, mollymawk',
167172
147:
168-
'grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus',
173+
'grey whale, gray whale, devilfish, Eschrichtius gibbosus, ' +
174+
'Eschrichtius robustus',
169175
148: 'killer whale, killer, orca, grampus, sea wolf, Orcinus orca',
170176
149: 'dugong, Dugong dugon',
171177
150: 'sea lion',
@@ -199,7 +205,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
199205
178: 'Weimaraner',
200206
179: 'Staffordshire bullterrier, Staffordshire bull terrier',
201207
180:
202-
'American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier',
208+
'American Staffordshire terrier, Staffordshire terrier, American pit ' +
209+
'bull terrier, pit bull terrier',
203210
181: 'Bedlington terrier',
204211
182: 'Border terrier',
205212
183: 'Kerry blue terrier',
@@ -306,7 +313,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
306313
284: 'Siamese cat, Siamese',
307314
285: 'Egyptian cat',
308315
286:
309-
'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
316+
'cougar, puma, catamount, mountain lion, painter, panther, ' +
317+
'Felis concolor',
310318
287: 'lynx, catamount',
311319
288: 'leopard, Panthera pardus',
312320
289: 'snow leopard, ounce, Panthera uncia',
@@ -315,7 +323,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
315323
292: 'tiger, Panthera tigris',
316324
293: 'cheetah, chetah, Acinonyx jubatus',
317325
294: 'brown bear, bruin, Ursus arctos',
318-
295: 'American black bear, black bear, Ursus americanus, Euarctos americanus',
326+
295: 'American black bear, black bear, Ursus americanus, Euarctos ' +
327+
'americanus',
319328
296: 'ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus',
320329
297: 'sloth bear, Melursus ursinus, Ursus ursinus',
321330
298: 'mongoose',
@@ -340,7 +349,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
340349
317: 'leafhopper',
341350
318: 'lacewing, lacewing fly',
342351
319:
343-
'dragonfly, darning needle, devil\'s darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk',
352+
'dragonfly, darning needle, devil\'s darning needle, sewing needle, ' +
353+
'snake feeder, snake doctor, mosquito hawk, skeeter hawk',
344354
320: 'damselfly',
345355
321: 'admiral',
346356
322: 'ringlet, ringlet butterfly',
@@ -371,7 +381,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
371381
347: 'bison',
372382
348: 'ram, tup',
373383
349:
374-
'bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis',
384+
'bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky ' +
385+
'Mountain sheep, Ovis canadensis',
375386
350: 'ibex, Capra ibex',
376387
351: 'hartebeest',
377388
352: 'impala, Aepyceros melampus',
@@ -414,7 +425,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
414425
389: 'barracouta, snoek',
415426
390: 'eel',
416427
391:
417-
'coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch',
428+
'coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus ' +
429+
'kisutch',
418430
392: 'rock beauty, Holocanthus tricolor',
419431
393: 'anemone fish',
420432
394: 'sturgeon',
@@ -436,7 +448,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
436448
410: 'apiary, bee house',
437449
411: 'apron',
438450
412:
439-
'ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin',
451+
'ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, ' +
452+
'dustbin, trash barrel, trash bin',
440453
413: 'assault rifle, assault gun',
441454
414: 'backpack, back pack, knapsack, packsack, rucksack, haversack',
442455
415: 'bakery, bakeshop, bakehouse',
@@ -461,7 +474,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
461474
434: 'bath towel',
462475
435: 'bathtub, bathing tub, bath, tub',
463476
436:
464-
'beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon',
477+
'beach wagon, station wagon, wagon, estate car, beach waggon, station ' +
478+
'waggon, waggon',
465479
437: 'beacon, lighthouse, beacon light, pharos',
466480
438: 'beaker',
467481
439: 'bearskin, busby, shako',
@@ -506,7 +520,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
506520
478: 'carton',
507521
479: 'car wheel',
508522
480:
509-
'cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM',
523+
'cash machine, cash dispenser, automated teller machine, automatic ' +
524+
'teller machine, automated teller, automatic teller, ATM',
510525
481: 'cassette',
511526
482: 'cassette player',
512527
483: 'castle',
@@ -517,7 +532,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
517532
488: 'chain',
518533
489: 'chainlink fence',
519534
490:
520-
'chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour',
535+
'chain mail, ring mail, mail, chain armor, chain armour, ring armor, ' +
536+
'ring armour',
521537
491: 'chain saw, chainsaw',
522538
492: 'chest',
523539
493: 'chiffonier, commode',
@@ -659,7 +675,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
659675
629: 'lipstick, lip rouge',
660676
630: 'Loafer',
661677
631: 'lotion',
662-
632: 'loudspeaker, speaker, speaker unit, loudspeaker system, speaker system',
678+
632: 'loudspeaker, speaker, speaker unit, loudspeaker system, speaker ' +
679+
'system',
663680
633: 'loupe, jeweler\'s loupe',
664681
634: 'lumbermill, sawmill',
665682
635: 'magnetic compass',
@@ -762,7 +779,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
762779
732: 'Polaroid camera, Polaroid Land camera',
763780
733: 'pole',
764781
734:
765-
'police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria',
782+
'police van, police wagon, paddy wagon, patrol wagon, wagon, black ' +
783+
'Maria',
766784
735: 'poncho',
767785
736: 'pool table, billiard table, snooker table',
768786
737: 'pop bottle, soda bottle',
@@ -896,7 +914,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
896914
865: 'toyshop',
897915
866: 'tractor',
898916
867:
899-
'trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi',
917+
'trailer truck, tractor trailer, trucking rig, rig, articulated ' +
918+
'lorry, semi',
900919
868: 'tray',
901920
869: 'trench coat',
902921
870: 'tricycle, trike, velocipede',
@@ -1016,7 +1035,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
10161035
984: 'rapeseed',
10171036
985: 'daisy',
10181037
986:
1019-
'yellow lady\'s slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum',
1038+
'yellow lady\'s slipper, yellow lady-slipper, Cypripedium calceolus, ' +
1039+
'Cypripedium parviflorum',
10201040
987: 'corn',
10211041
988: 'acorn',
10221042
989: 'hip, rose hip, rosehip',
@@ -1027,7 +1047,8 @@ export const IMAGENET_CLASSES: {[key: number]: string} = {
10271047
994: 'stinkhorn, carrion fungus',
10281048
995: 'earthstar',
10291049
996:
1030-
'hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa',
1050+
'hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola ' +
1051+
'frondosa',
10311052
997: 'bolete',
10321053
998: 'ear, spike, capitulum',
10331054
999: 'toilet tissue, toilet paper, bathroom tissue'

0 commit comments

Comments
 (0)