-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImplement_convolutional_layer_in_PyTorch.mhtml
18281 lines (13800 loc) · 839 KB
/
Implement_convolutional_layer_in_PyTorch.mhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From: <Saved by Blink>
Snapshot-Content-Location: https://discuss.pytorch.org/t/how-to-implement-a-convolutional-layer/68211/7
Subject: How to Implement a convolutional layer - PyTorch Forums
Date: Thu, 21 Apr 2022 15:57:23 -0000
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----MultipartBoundary--GHJm4G2TFodOD75QNEcTHsDVcQ4TZ4nvE1N3ztY9aW----"
------MultipartBoundary--GHJm4G2TFodOD75QNEcTHsDVcQ4TZ4nvE1N3ztY9aW----
Content-Type: text/html
Content-ID: <[email protected]>
Content-Transfer-Encoding: quoted-printable
Content-Location: https://discuss.pytorch.org/t/how-to-implement-a-convolutional-layer/68211/7
<!DOCTYPE html><html lang=3D"en" class=3D"desktop-view not-mobile-device te=
xt-size-normal anon no-touch discourse-no-touch message-bus-offline" style=
=3D"--header-offset:60.025px;"><head><meta http-equiv=3D"Content-Type" cont=
ent=3D"text/html; charset=3DUTF-8">
=20
<title>How to Implement a convolutional layer - PyTorch Forums</title>
<meta name=3D"description" content=3D"Hello all,=20
For my research, I=E2=80=99m required to implement a convolution-like layer=
i.e something that slides over some input (assume 1D for simplicity), perf=
orms some operation and generates basically an output feature map.&hell=
ip;">
<meta name=3D"discourse_theme_id" content=3D"2">
<meta name=3D"discourse_current_homepage" content=3D"categories">
<meta name=3D"generator" content=3D"Discourse 2.9.0.beta3 - https://git=
hub.com/discourse/discourse version 86a783b3ad0f11674c0786daf5484d64f624a0a=
f">
<link rel=3D"icon" type=3D"image/png" href=3D"https://discuss.pytorch.org/u=
ploads/default/optimized/2X/b/bb2eeaba4e9f7e4a5944a0d83f52c4f2bf1b6a85_2_32=
x32.png">
<link rel=3D"apple-touch-icon" type=3D"image/png" href=3D"https://discuss.p=
ytorch.org/uploads/default/optimized/2X/3/38d28fd067a1a8f263e14507942b2e38e=
49b771a_2_180x180.png">
<meta name=3D"theme-color" content=3D"#ffffff">
<meta name=3D"viewport" content=3D"width=3Ddevice-width, initial-scale=3D1.=
0, minimum-scale=3D1.0, user-scalable=3Dyes, viewport-fit=3Dcover">
<link rel=3D"canonical" href=3D"https://discuss.pytorch.org/t/how-to-implem=
ent-a-convolutional-layer/68211">
<link rel=3D"search" type=3D"application/opensearchdescription+xml" href=3D=
"https://discuss.pytorch.org/opensearch.xml" title=3D"PyTorch Forums Search=
">
=20
<link href=3D"https://discuss.pytorch.org/stylesheets/color_definitions=
_base__2_fa0ee933dd1757531208818470b1aee744ef127c.css?__ws=3Ddiscuss.pytorc=
h.org" media=3D"all" rel=3D"stylesheet" class=3D"light-scheme">
<link href=3D"https://discuss.pytorch.org/stylesheets/desktop_4984c69057d=
decb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" media=3D"all"=
rel=3D"stylesheet" data-target=3D"desktop">
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-akismet_4=
984c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" med=
ia=3D"all" rel=3D"stylesheet" data-target=3D"discourse-akismet">
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-details_4=
984c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" med=
ia=3D"all" rel=3D"stylesheet" data-target=3D"discourse-details">
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-local-dat=
es_4984c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org"=
media=3D"all" rel=3D"stylesheet" data-target=3D"discourse-local-dates">
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-narrative=
-bot_4984c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.or=
g" media=3D"all" rel=3D"stylesheet" data-target=3D"discourse-narrative-bot"=
>
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-presence_=
4984c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" me=
dia=3D"all" rel=3D"stylesheet" data-target=3D"discourse-presence">
<link href=3D"https://discuss.pytorch.org/stylesheets/discourse-solved_49=
84c69057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" medi=
a=3D"all" rel=3D"stylesheet" data-target=3D"discourse-solved">
<link href=3D"https://discuss.pytorch.org/stylesheets/lazy-yt_4984c69057d=
decb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" media=3D"all"=
rel=3D"stylesheet" data-target=3D"lazy-yt">
<link href=3D"https://discuss.pytorch.org/stylesheets/poll_4984c69057ddec=
b5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" media=3D"all" re=
l=3D"stylesheet" data-target=3D"poll">
<link href=3D"https://discuss.pytorch.org/stylesheets/poll_desktop_4984c6=
9057ddecb5a372f0dddd1a56900c5e5d36.css?__ws=3Ddiscuss.pytorch.org" media=3D=
"all" rel=3D"stylesheet" data-target=3D"poll_desktop">
<link href=3D"https://discuss.pytorch.org/stylesheets/desktop_theme_2_540=
a4960d48d442da56b84795534217ad2d6e71f.css?__ws=3Ddiscuss.pytorch.org" media=
=3D"all" rel=3D"stylesheet" data-target=3D"desktop_theme" data-theme-id=3D"=
2" data-theme-name=3D"light">
<meta name=3D"fragment" content=3D"!">
=20
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/start-=
discourse-56beeae7bfaedb687069f01c78f5450d.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/browse=
r-update-eec13eb6f8386f18f10b5dd6ebb7a3598d28421bb796e539b91a7e4a4c5d4c08.j=
s" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/browse=
r-detect-16ca87077aead9f656700e192992122d3a7eee8c1bb76da992127945464d4777.j=
s" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/locale=
s/en-03748ff7f7338446c7d5fbf57a5ec49485501f53190f8378afd24fa00aada295.js" a=
s=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/vendor=
-ecdfc2d429e185e369cd03c67ce135ab.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.178.=
e4bd1c0bca65c287e058-8e3a4f6dedd31c81bbc3a1d0913643ca.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.293.=
2add4bb22c2c5a983a16-01c24e6ab0e1a6f37a345227309fcef0.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.529.=
6ee9018498e97f872147-248a6f3ff1492f6e27f3e7b6d099d3b4.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.143.=
153b106f897cb2e671b8-a72d28883bf22c2bb530dec52714fea9.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.143.=
f3707aab8ddb18dae851-ab5ba765407863ad7e1e8f426525759b.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.178.=
acc2da28f3315a7d0f59-6a3221586ec896e89906e3d697603476.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.178.=
bb19e0b7a08e6fa15498-84c9c238cd1e2b0c82e70dda370672db.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.529.=
a24dde613337deff89a3-73e7443cb0acc64b39f1341174f670d5.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/chunk.143.=
62cb0a71c9edb3273a0f-9930935a71aad68652a9334a03d81b74.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/applic=
ation-8b0b52f3146ad67b3554b7ce0c5b47f0.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-akismet-d6c1c1c032720106173fcc509755dd02835c66acdbed6c6d6c254=
3fe865ba4d8.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-details-a5c71c75398c735e851440262e3c9ba43f9d8a2a7d81d8ecec16c=
8b2dbf452c3.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-local-dates-7252d475b21ad32a0928a3da48d779baa382f7841525f4a4a=
6e5a59ac59676b3.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-narrative-bot-7648c8e9699610bc9a41dc34d627f0227a7501feb863a8d=
84ec0ab1bdc745e3d.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-presence-bc826a395189b32e4676ad0c4414f821f9bab8245747789b6d55=
5fc16581dacd.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/discourse-solved-25fb8a39a7251e3f126bff6e87bc94d7183343a78ad8ad33636762=
e80c493b17.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/docker_manager-4ced9f9c7bda9ba563c04006dbb93828d43f2c7d5b533065717c5a63=
da77d5fc.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/lazy-yt-362fd991a752ebdc53b9b3b70aea43cb46676f634c323d6c79c0bef4c6bebad=
3.js" as=3D"script">
<link rel=3D"preload" href=3D"https://discuss.pytorch.org/assets/plug=
ins/poll-f30b28a9869fcfda75a43a6b88dcf0a855e03654b3e5edba2bf0c998b5500e3e.j=
s" as=3D"script">
=20
=20
=20
=20
=20
<link id=3D"manifest-link" rel=3D"manifest" href=3D"https://discuss.pyt=
orch.org/manifest.webmanifest" crossorigin=3D"use-credentials">
<link rel=3D"alternate nofollow" type=3D"application/rss+xml" title=
=3D"RSS feed of 'How to Implement a convolutional layer'" href=3D"https://d=
iscuss.pytorch.org/t/how-to-implement-a-convolutional-layer/68211.rss">
<meta property=3D"og:site_name" content=3D"PyTorch Forums">
<meta property=3D"og:type" content=3D"website">
<meta name=3D"twitter:card" content=3D"summary">
<meta name=3D"twitter:image" content=3D"https://discuss.pytorch.org/uploads=
/default/original/2X/1/15a7e2573aeb9e6ba8995f824d3b63171a433041.png">
<meta property=3D"og:image" content=3D"https://discuss.pytorch.org/uploads/=
default/original/2X/1/15a7e2573aeb9e6ba8995f824d3b63171a433041.png">
<meta property=3D"og:url" content=3D"https://discuss.pytorch.org/t/how-to-i=
mplement-a-convolutional-layer/68211">
<meta name=3D"twitter:url" content=3D"https://discuss.pytorch.org/t/how-to-=
implement-a-convolutional-layer/68211">
<meta property=3D"og:title" content=3D"How to Implement a convolutional lay=
er - PyTorch Forums">
<meta name=3D"twitter:title" content=3D"How to Implement a convolutional la=
yer">
<meta property=3D"og:description" content=3D"Hello all, For my research, I=
=E2=80=99m required to implement a convolution-like layer i.e something tha=
t slides over some input (assume 1D for simplicity), performs some operatio=
n and generates basically an output feature map. While this is perfectly si=
milar to regular convolution, the difference here is the operation being pe=
rformed - its not regular convolution. I looked through the PyTorch code on=
GitHub but it seems to rely on some sort of convolution primitive=E2=80=A6=
Is there a straightforward way to ...">
<meta name=3D"twitter:description" content=3D"Hello all, For my research, =
I=E2=80=99m required to implement a convolution-like layer i.e something th=
at slides over some input (assume 1D for simplicity), performs some operati=
on and generates basically an output feature map. While this is perfectly s=
imilar to regular convolution, the difference here is the operation being p=
erformed - its not regular convolution. I looked through the PyTorch code o=
n GitHub but it seems to rely on some sort of convolution primitive=E2=80=
=A6 Is there a straightforward way to ...">
<meta name=3D"twitter:label1" value=3D"Reading time">
<meta name=3D"twitter:data1" value=3D"1 mins =F0=9F=95=91">
<meta name=3D"twitter:label2" value=3D"Likes">
<meta name=3D"twitter:data2" value=3D"6 =E2=9D=A4">
<meta property=3D"article:published_time" content=3D"2020-01-31T08:33:32+00=
:00">
<meta property=3D"og:ignore_canonical" content=3D"true">
=20
<meta id=3D"data-discourse-setup" data-base-url=3D"https://discuss.pyto=
rch.org" data-base-uri=3D"" data-environment=3D"production" data-letter-ava=
tar-version=3D"5_684b749d1c1eee86b31a584fa946fc1a" data-markdown-it-url=3D"=
/assets/markdown-it-bundle-26ea453fd355743aa4f67837c10b6d9ac4501aefa1420de0=
42a8ed7e2fe3d0ed.js" data-service-worker-url=3D"service-worker.js" data-def=
ault-locale=3D"en" data-asset-version=3D"6cab35cbe4dd14560b5572cdd7f8d231" =
data-disable-custom-css=3D"false" data-highlight-js-path=3D"/highlight-js/d=
iscuss.pytorch.org/29484cf029bf2998fc1b67022a0850bb6d71722b.js" data-svg-sp=
rite-path=3D"/svg-sprite/discuss.pytorch.org/svg-2-7acc18556c79a84b6d7c3127=
9121e31381bcb379.js" data-enable-js-error-reporting=3D"true" data-color-sch=
eme-is-dark=3D"false" data-user-dark-scheme-id=3D"-1">
<meta name=3D"discourse/config/environment" content=3D"%7B%22modulePref=
ix%22%3A%22discourse%22%2C%22environment%22%3A%22production%22%2C%22rootURL=
%22%3A%22%22%2C%22locationType%22%3A%22auto%22%2C%22historySupportMiddlewar=
e%22%3Afalse%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROT=
OTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%=
3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22=
%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22discourse%22%2C%22version%22%3A=
%222.9.0.beta3%2086a783b3ad0f11674c0786daf5484d64f624a0af%22%2C%22exportApp=
licationGlobal%22%3Atrue%7D%7D">
</head>
<body class=3D"archetype-regular category category-uncategorized docked">
=20
=20
=20
=20
=20
<section id=3D"main" class=3D"ember-application">
<div id=3D"ember4" class=3D"ember-view"> <a href=3D"https://discuss.py=
torch.org/t/how-to-implement-a-convolutional-layer/68211/7#main-container" =
id=3D"skip-link">Skip to main content</a>
<!---->
<!---->
<div id=3D"ember7" class=3D"d-header-wrap ember-view"><header class=3D"d-=
header clearfix"><div class=3D"wrap"><div class=3D"contents clearfix">
<div class=3D"title"><a href=3D"https://discuss.pytorch.org/" data-auto=
-route=3D"true"><img src=3D"https://discuss.pytorch.org/uploads/default/ori=
ginal/2X/3/38d28fd067a1a8f263e14507942b2e38e49b771a.png" width=3D"36" alt=
=3D"PyTorch Forums" id=3D"site-logo" class=3D"logo-small"></a></div>
<div class=3D"extra-info-wrapper"><div class=3D"extra-info"><div clas=
s=3D"title-wrapper"><h1 class=3D"header-title"><span class=3D"topic-statuse=
s"></span><a class=3D"widget-link topic-link" href=3D"https://discuss.pytor=
ch.org/t/how-to-implement-a-convolutional-layer/68211" title=3D"" data-topi=
c-id=3D"68211"><span>How to Implement a convolutional layer</span></a></h1>=
</div></div></div>
<div class=3D"panel clearfix" role=3D"navigation"><span class=3D"header=
-buttons"><button class=3D"widget-button btn btn-primary btn-small login-bu=
tton btn-icon-text"><svg class=3D"fa d-icon d-icon-user svg-icon svg-node" =
aria-hidden=3D"true"><use xlink:href=3D"#user"></use></svg><span class=3D"d=
-button-label">Log In</span></button></span><ul class=3D"icons d-header-ico=
ns"><li class=3D"header-dropdown-toggle search-dropdown"><a aria-expanded=
=3D"false" aria-haspopup=3D"true" href=3D"https://discuss.pytorch.org/searc=
h" data-auto-route=3D"true" title=3D"Search" aria-label=3D"Search" id=3D"se=
arch-button" class=3D"icon btn-flat"><svg class=3D"fa d-icon d-icon-search =
svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D"#search"></use><=
/svg></a></li><li class=3D"header-dropdown-toggle hamburger-dropdown"><a ar=
ia-expanded=3D"false" aria-haspopup=3D"true" href=3D"https://discuss.pytorc=
h.org/t/how-to-implement-a-convolutional-layer/68211/7" data-auto-route=3D"=
true" title=3D"menu" aria-label=3D"menu" id=3D"toggle-hamburger-menu" class=
=3D"icon btn-flat"><svg class=3D"fa d-icon d-icon-bars svg-icon svg-node" a=
ria-hidden=3D"true"><use xlink:href=3D"#bars"></use></svg></a></li></ul></d=
iv>
</div></div></header></div>
<!---->
<!---->
<div id=3D"main-outlet" class=3D"wrap" role=3D"main">
<!---->
<div class=3D"container" id=3D"main-container">
<div id=3D"ember11" class=3D"ember-view"></div>
<div id=3D"ember12" class=3D"controls ember-view"><!----></div>
<div id=3D"ember13" class=3D"ember-view"><!----></div>
<div id=3D"ember14" class=3D"ember-view"><!----></div>
<div id=3D"ember15" class=3D"hidden create-topics-notice ember-view">=
<!----></div>
<!---->
</div>
<div id=3D"ember17" class=3D"regular ember-view"> <!---->
<!---->
<div class=3D"container">
<div id=3D"ember20" class=3D"ember-view"><!----></div>
</div>
<!---->
<span id=3D"ember21" class=3D"ember-view"> <div id=3D"ember23" class=3D"=
topic-above-post-stream-outlet topic-removed-notification ember-view"><!---=
-></div>
</span>
<div id=3D"topic-title" class=3D"ember-view"><div class=3D"container">
<div class=3D"title-wrapper">
<h1 data-topic-id=3D"68211">
<!---->
<div id=3D"ember25" class=3D"topic-statuses ember-view"><!---=
-><!----><!----><!----><!----><!----><!----><!----><!----></div>
<a href=3D"https://discuss.pytorch.org/t/how-to-implement-a-c=
onvolutional-layer/68211" class=3D"fancy-title" data-ember-action=3D"" data=
-ember-action-27=3D"27">
How to Implement a convolutional layer
</a>
<!----> </h1>
<div id=3D"ember28" class=3D"topic-category ember-view"> <!---->
<div class=3D"topic-header-extra">
<!----> <!---->
</div>
<span id=3D"ember29" class=3D"ember-view"><!----></span>
</div>
</div>
<span id=3D"ember30" class=3D"ember-view"><!----></span>
</div>
</div>
<!---->
<div class=3D"container posts">
<div class=3D"selected-posts hidden">
<div id=3D"ember31" class=3D"ember-view"><p>
<span id=3D"ember32" class=3D"ember-view">You have selected <b>0</b> post=
s.
</span>
</p>
<p>
<a class=3D"select-all" href=3D"https://discuss.pytorch.org/t/how-to-im=
plement-a-convolutional-layer/68211/7" data-ember-action=3D"" data-ember-ac=
tion-33=3D"33">
select all
</a>
</p>
<!---->
<!---->
<!---->
<!---->
<!---->
<p class=3D"cancel">
<a href=3D"https://discuss.pytorch.org/t/how-to-implement-a-convolutional=
-layer/68211/7" data-ember-action=3D"" data-ember-action-34=3D"34">
cancel selecting
</a>
</p>
</div>
</div>
<!---->
<div id=3D"ember36" class=3D"topic-navigation with-timeline ember-view"> =
<div id=3D"ember39" class=3D"topic-navigation-outlet no-answer emb=
er-view"><!----></div>
<div id=3D"ember89" class=3D"ember-view"><div class=3D"timeline-c=
ontainer"><div class=3D"topic-timeline"><div class=3D"timeline-controls"></=
div><div class=3D"timeline-scrollarea-wrapper"><div class=3D"timeline-date-=
wrapper"><a class=3D"widget-link start-date" href=3D"https://discuss.pytorc=
h.org/t/how-to-implement-a-convolutional-layer/68211/7" title=3D"Jan 2020">=
<span class=3D"d-label">Jan 2020</span></a></div><div style=3D"height: 300p=
x" class=3D"timeline-scrollarea"><div style=3D"height: 151.19508533501897px=
" class=3D"timeline-padding"></div><div style=3D"height: 50px" class=3D"tim=
eline-scroller"><div class=3D"timeline-handle"></div><div class=3D"timeline=
-scroller-content"><div class=3D"timeline-replies">7 / 10</div><div class=
=3D"timeline-ago">Feb 2020</div></div></div><div style=3D"height: 98.804914=
66498103px" class=3D"timeline-padding"></div></div><div class=3D"timeline-d=
ate-wrapper"><a class=3D"widget-link now-date" href=3D"https://discuss.pyto=
rch.org/t/how-to-implement-a-convolutional-layer/68211/7" title=3D"Sep 2020=
"><span class=3D"d-label">Sep 2020</span></a></div></div><div class=3D"time=
line-footer-controls"></div></div></div></div>
</div>
<div class=3D"row">
<section class=3D"topic-area" id=3D"topic" data-topic-id=3D"68211">
<div class=3D"posts-wrapper">
<div id=3D"ember43" class=3D"loading-container ember-view"> =20
</div>
<span id=3D"ember44" class=3D"ember-view"><!----></span>
<div id=3D"ember45" class=3D"ember-view"><div class=3D"post-s=
tream"><div class=3D"topic-post clearfix topic-owner regular"><article id=
=3D"post_1" aria-label=3D"post #1 by @madarax64" role=3D"region" data-post-=
id=3D"162294" data-topic-id=3D"68211" data-user-id=3D"10151" class=3D"boxed=
onscreen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"=
></span><div class=3D"row"><div class=3D"topic-avatar" style=3D"margin-bott=
om: 56px;"><div class=3D"post-avatar"><a class=3D"trigger-user-card main-av=
atar " href=3D"https://discuss.pytorch.org/u/madarax64" data-user-card=3D"m=
adarax64" aria-hidden=3D"true" tabindex=3D"-1"><img alt=3D"" width=3D"45" h=
eight=3D"45" src=3D"https://discuss.pytorch.org/letter_avatar_proxy/v4/lett=
er/m/e47c2d/90.png" loading=3D"lazy" class=3D"avatar"></a></div></div><div =
class=3D"topic-body clearfix"><div role=3D"heading" aria-level=3D"2" class=
=3D"topic-meta-data"><div class=3D"names trigger-user-card"><span class=3D"=
first username"><a href=3D"https://discuss.pytorch.org/u/madarax64" data-us=
er-card=3D"madarax64" class=3D"">madarax64</a></span><span class=3D"second =
full-name"><a href=3D"https://discuss.pytorch.org/u/madarax64" data-user-ca=
rd=3D"madarax64" class=3D"">M.B.</a></span></div><div class=3D"post-infos">=
<div class=3D"post-info post-date"><a class=3D"post-date"><span title=3D"Ja=
n 31, 2020 4:33 pm" data-time=3D"1580459612999" data-format=3D"tiny" class=
=3D"relative-date">Jan '20</span></a></div><div class=3D"read-state read" t=
itle=3D"Post is unread"><svg class=3D"fa d-icon d-icon-circle svg-icon svg-=
node" aria-hidden=3D"true"><use xlink:href=3D"#circle"></use></svg></div></=
div></div><div class=3D"regular contents"><div class=3D"cooked"><p>Hello al=
l,<br>
For my research, I=E2=80=99m required to implement a convolution-like layer=
i.e something that slides over some input (assume 1D for simplicity), perf=
orms some operation and generates basically an output feature map. While th=
is is perfectly similar to regular convolution, the difference here is the =
operation being performed - its not regular convolution. I looked through t=
he PyTorch code on GitHub but it seems to rely on some sort of convolution =
primitive=E2=80=A6<br>
Is there a straightforward way to implement this?</p>
<p>Thanks</p></div><div class=3D"cooked">
<aside class=3D"quote accepted-answer" data-post=3D"2" data-top=
ic=3D"68211">
<div class=3D"title" style=3D"cursor: pointer;">
<svg class=3D"fa d-icon d-icon-check-square svg-icon accept=
ed svg-string" xmlns=3D"http://www.w3.org/2000/svg"><use href=3D"#check-squ=
are"></use></svg> Solved <span class=3D"by">by <a href=3D"https://discuss.p=
ytorch.org/t/how-to-implement-a-convolutional-layer/68211/7" data-user-card=
=3D"ptrblck">ptrblck</a></span> in <a href=3D"https://discuss.pytorch.org/t=
/how-to-implement-a-convolutional-layer/68211/2" class=3D"back">post #2</a>=
<div class=3D"quote-controls"><button aria-controls=3D"quote-id-68211-2-0"=
aria-expanded=3D"false" class=3D"quote-toggle btn-flat"><span class=3D"svg=
-icon-title" title=3D"expand/collapse"><svg class=3D"fa d-icon d-icon-chevr=
on-down svg-icon svg-string" xmlns=3D"http://www.w3.org/2000/svg"><use href=
=3D"#chevron-down"></use></svg></span></button></div>
</div>
<blockquote id=3D"quote-id-68211-2-0">
You could use unfold as descibed <a href=3D"https://discuss=
.pytorch.org/t/efficiently-slicing-tensor-like-a-convolution/44840/2">here<=
/a> to create the patches, which would be used in the convolution.=20
Instead of a multiplication and summation you could apply your custom opera=
tion on each patch and reshape the output to the desired shape.
</blockquote>
</aside></div><section class=3D"post-menu-area clearfix"><nav c=
lass=3D"post-controls expanded"><div class=3D"actions"><div class=3D"double=
-button"><button class=3D"widget-button btn-flat button-count like-count hi=
ghlight-action regular-likes btn-text" title=3D"2 people liked this post" a=
ria-label=3D"2 people liked this post. Click to view" aria-pressed=3D"false=
">2</button><button class=3D"widget-button btn-flat toggle-like like no-tex=
t btn-icon" title=3D"like this post" data-post-id=3D"162294"><svg class=3D"=
fa d-icon d-icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xli=
nk:href=3D"#far-heart"></use></svg></button></div><button class=3D"widget-b=
utton btn-flat share no-text btn-icon" title=3D"share a link to this post">=
<svg class=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=
=3D"true"><use xlink:href=3D"#link"></use></svg></button></div></nav></sect=
ion></div><section class=3D"post-actions">
</section><div class=3D"post-links-container"></div><div class=3D"topic-m=
ap"><section class=3D"map map-collapsed"><nav class=3D"buttons"><button cla=
ss=3D"widget-button btn no-text btn-icon" title=3D"expand topic details"><s=
vg class=3D"fa d-icon d-icon-chevron-down svg-icon svg-node" aria-hidden=3D=
"true"><use xlink:href=3D"#chevron-down"></use></svg></button></nav><ul cla=
ss=3D"clearfix"><li class=3D"created-at"><h4 role=3D"presentation">created<=
/h4><div class=3D"topic-map-post created-at"><a class=3D"trigger-user-card =
" data-user-card=3D"madarax64" aria-hidden=3D"true"><img alt=3D"" width=3D"=
20" height=3D"20" src=3D"https://discuss.pytorch.org/letter_avatar_proxy/v4=
/letter/m/e47c2d/40.png" title=3D"M.B." aria-label=3D"M.B." loading=3D"lazy=
" class=3D"avatar"></a><span title=3D"Jan 31, 2020 4:33 pm" data-time=3D"15=
80459612940" data-format=3D"tiny" class=3D"relative-date">Jan '20</span></d=
iv></li><li class=3D"last-reply"><a href=3D"https://discuss.pytorch.org/t/h=
ow-to-implement-a-convolutional-layer/68211/10"><h4 role=3D"presentation">l=
ast reply</h4><div class=3D"topic-map-post last-reply"><a class=3D"trigger-=
user-card " data-user-card=3D"ptrblck" aria-hidden=3D"true"><img alt=3D"" w=
idth=3D"20" height=3D"20" src=3D"https://discuss.pytorch.org/user_avatar/di=
scuss.pytorch.org/ptrblck/40/1823_2.png" title=3D"ptrblck" aria-label=3D"pt=
rblck" loading=3D"lazy" class=3D"avatar"></a><span title=3D"Sep 13, 2020 4:=
52 am" data-time=3D"1599943965794" data-format=3D"tiny" class=3D"relative-d=
ate">Sep '20</span></div></a></li><li class=3D"replies"><span class=3D"numb=
er">9</span><h4 role=3D"presentation">replies</h4></li><li class=3D"seconda=
ry views"><span class=3D"number heatmap-high" title=3D"5109">5.1k</span><h4=
role=3D"presentation">views</h4></li><li class=3D"secondary users"><span c=
lass=3D"number">3</span><h4 role=3D"presentation">users</h4></li><li class=
=3D"secondary likes"><span class=3D"number">6</span><h4 role=3D"presentatio=
n">likes</h4></li><li class=3D"secondary links"><span class=3D"number">3</s=
pan><h4 role=3D"presentation">links</h4></li><li class=3D"avatars"><div><a =
class=3D"poster trigger-user-card" title=3D"madarax64" data-user-card=3D"ma=
darax64"><img alt=3D"" width=3D"32" height=3D"32" src=3D"https://discuss.py=
torch.org/letter_avatar_proxy/v4/letter/m/e47c2d/64.png" title=3D"M.B." ari=
a-label=3D"M.B." loading=3D"lazy" class=3D"avatar"><span class=3D"post-coun=
t">5</span></a></div><div><a class=3D"poster trigger-user-card" title=3D"pt=
rblck" data-user-card=3D"ptrblck"><img alt=3D"" width=3D"32" height=3D"32" =
src=3D"https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/=
64/1823_2.png" title=3D"ptrblck" aria-label=3D"ptrblck" loading=3D"lazy" cl=
ass=3D"avatar"><span class=3D"post-count">4</span></a></div><div><a class=
=3D"poster trigger-user-card" title=3D"Poornima_Jain" data-user-card=3D"Poo=
rnima_Jain"><img alt=3D"" width=3D"32" height=3D"32" src=3D"https://discuss=
.pytorch.org/user_avatar/discuss.pytorch.org/poornima_jain/64/14833_2.png" =
title=3D"Poornima Jain" aria-label=3D"Poornima Jain" loading=3D"lazy" class=
=3D"avatar"></a></div></li></ul></section></div></div></div></article></div=
><div class=3D"topic-post clearfix regular"><article id=3D"post_2" aria-lab=
el=3D"post #2 by @ptrblck" role=3D"region" data-post-id=3D"162589" data-top=
ic-id=3D"68211" data-user-id=3D"3534" class=3D"boxed onscreen-post"><span a=
ria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"></span><div class=3D"r=
ow"><div class=3D"topic-avatar"><div class=3D"post-avatar"><a class=3D"trig=
ger-user-card main-avatar " href=3D"https://discuss.pytorch.org/u/ptrblck" =
data-user-card=3D"ptrblck" aria-hidden=3D"true" tabindex=3D"-1"><img alt=3D=
"" width=3D"45" height=3D"45" src=3D"https://discuss.pytorch.org/user_avata=
r/discuss.pytorch.org/ptrblck/90/1823_2.png" loading=3D"lazy" class=3D"avat=
ar"></a></div></div><div class=3D"topic-body clearfix"><div role=3D"heading=
" aria-level=3D"2" class=3D"topic-meta-data"><div class=3D"names trigger-us=
er-card"><span class=3D"first username staff admin moderator"><a href=3D"ht=
tps://discuss.pytorch.org/u/ptrblck" data-user-card=3D"ptrblck" class=3D"">=
ptrblck</a><span title=3D"This user is a moderator" class=3D"svg-icon-title=
"><svg class=3D"fa d-icon d-icon-shield-alt svg-icon svg-node" aria-hidden=
=3D"true"><use xlink:href=3D"#shield-alt"></use></svg></span></span></div><=
div class=3D"post-infos"><div class=3D"post-info post-date"><a class=3D"pos=
t-date"><span title=3D"Feb 1, 2020 3:44 pm" data-time=3D"1580543065779" dat=
a-format=3D"tiny" class=3D"relative-date">Feb '20</span></a></div><div clas=
s=3D"read-state read" title=3D"Post is unread"><svg class=3D"fa d-icon d-ic=
on-circle svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D"#circl=
e"></use></svg></div></div></div><div class=3D"regular contents"><div class=
=3D"cooked"><p>You could use <code>unfold</code> as descibed <a href=3D"htt=
ps://discuss.pytorch.org/t/efficiently-slicing-tensor-like-a-convolution/44=
840/2">here <span class=3D"badge badge-notification clicks" title=3D"335 cl=
icks">335</span></a> to create the patches, which would be used in the conv=
olution.<br>
Instead of a multiplication and summation you could apply your custom opera=
tion on each patch and reshape the output to the desired shape.</p></div><s=
ection class=3D"post-menu-area clearfix"><nav class=3D"post-controls expand=
ed"><div class=3D"actions"><span class=3D"extra-buttons"><span title=3D"Thi=
s is the accepted solution to this topic" class=3D"accepted-text"><span><sv=
g class=3D"fa d-icon d-icon-check svg-icon svg-node" aria-hidden=3D"true"><=
use xlink:href=3D"#check"></use></svg></span><span class=3D"accepted-label"=
>Solution</span></span><button class=3D"widget-button btn-flat hidden no-te=
xt" disabled=3D"true"></button></span><div class=3D"double-button"><button =
class=3D"widget-button btn-flat button-count like-count highlight-action re=
gular-likes btn-text" title=3D"1 person liked this post" aria-label=3D"1 pe=
rson liked this post. Click to view" aria-pressed=3D"false">1</button><butt=
on class=3D"widget-button btn-flat toggle-like like no-text btn-icon" title=
=3D"like this post" data-post-id=3D"162589"><svg class=3D"fa d-icon d-icon-=
d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D"#far-h=
eart"></use></svg></button></div><button class=3D"widget-button btn-flat sh=
are no-text btn-icon" title=3D"share a link to this post"><svg class=3D"fa =
d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"true"><use xli=
nk:href=3D"#link"></use></svg></button></div></nav></section></div><section=
class=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"topic-post clearfix topic-owner regular"><article id=
=3D"post_3" aria-label=3D"post #3 by @madarax64" role=3D"region" data-post-=
id=3D"162650" data-topic-id=3D"68211" data-user-id=3D"10151" class=3D"boxed=
onscreen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"=
></span><div class=3D"row"><div class=3D"topic-avatar"><div class=3D"post-a=
vatar"><a class=3D"trigger-user-card main-avatar " href=3D"https://discuss.=
pytorch.org/u/madarax64" data-user-card=3D"madarax64" aria-hidden=3D"true" =
tabindex=3D"-1"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://dis=
cuss.pytorch.org/letter_avatar_proxy/v4/letter/m/e47c2d/90.png" loading=3D"=
lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfix"><=
div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=
=3D"names trigger-user-card"><span class=3D"first username"><a href=3D"http=
s://discuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"=
">madarax64</a></span><span class=3D"second full-name"><a href=3D"https://d=
iscuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"">M.B=
.</a></span></div><div class=3D"post-infos"><div class=3D"post-info post-da=
te"><a class=3D"post-date"><span title=3D"Feb 1, 2020 11:32 pm" data-time=
=3D"1580571167986" data-format=3D"tiny" class=3D"relative-date">Feb '20</sp=
an></a></div><div class=3D"read-state read" title=3D"Post is unread"><svg c=
lass=3D"fa d-icon d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><us=
e xlink:href=3D"#circle"></use></svg></div></div></div><div class=3D"regula=
r contents"><div class=3D"cooked"><p>Thanks <a class=3D"mention" href=3D"ht=
tps://discuss.pytorch.org/u/ptrblck">@ptrblck</a>, that definitely seems to=
be what I=E2=80=99m looking for. However, I=E2=80=99m having a bit of a st=
range time understanding exactly how it works. For simplicity, assuming my =
data was 1D of the form (N,C,L) where N is the batch size (100, for example=
), C is the number of channels (1 in this case) and L is the length of the =
series (say 10). I want to break this into windows, each of length 5. In my=
understanding, I would do this as:</p>
<pre><code class=3D"hljs apache"><span class=3D"hljs-attribute">data</span>=
.unfold(<span class=3D"hljs-number">2</span>,<span class=3D"hljs-number">5<=
/span>,<span class=3D"hljs-number">1</span>) # <span class=3D"hljs-number">=
2</span> because I'm unfolding the L dimension, <span class=3D"hljs-number"=
>5</span> for the window size, and <span class=3D"hljs-number">1</span> for=
the step
</code></pre>
<p>However, the output I=E2=80=99m getting has a shape of</p>
<pre><code class=3D"hljs json">[<span class=3D"hljs-number">100</span>, <sp=
an class=3D"hljs-number">1</span>, <span class=3D"hljs-number">6</span>, <s=
pan class=3D"hljs-number">5</span>]
</code></pre>
<p>Which I have no idea how to interpret at all. On a related note, assumin=
g I wanted to convolve this against a filter also of length 5, how would I =
go about it? If the filter itself was to have trainable weights (just like =
traditional convolution), then I would have to declare the filter as being =
a Tensor, right?</p>
<p>Sorry for the all the questions, but I have difficulty understanding som=
e of this stuff=E2=80=A6Thanks again for the help. I really appreciate it.<=
/p></div><section class=3D"post-menu-area clearfix"><nav class=3D"post-cont=
rols expanded"><div class=3D"actions"><div class=3D"double-button"><button =
class=3D"widget-button btn-flat toggle-like like no-text btn-icon" title=3D=
"like this post" data-post-id=3D"162650"><svg class=3D"fa d-icon d-icon-d-u=
nliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D"#far-hear=
t"></use></svg></button></div><button class=3D"widget-button btn-flat share=
no-text btn-icon" title=3D"share a link to this post"><svg class=3D"fa d-i=
con d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"true"><use xlink:=
href=3D"#link"></use></svg></button></div></nav></section></div><section cl=
ass=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"topic-post clearfix regular"><article id=3D"post_4" ar=
ia-label=3D"post #4 by @ptrblck" role=3D"region" data-post-id=3D"162719" da=
ta-topic-id=3D"68211" data-user-id=3D"3534" class=3D"boxed onscreen-post"><=
span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"></span><div clas=
s=3D"row"><div class=3D"topic-avatar"><div class=3D"post-avatar"><a class=
=3D"trigger-user-card main-avatar " href=3D"https://discuss.pytorch.org/u/p=
trblck" data-user-card=3D"ptrblck" aria-hidden=3D"true" tabindex=3D"-1"><im=
g alt=3D"" width=3D"45" height=3D"45" src=3D"https://discuss.pytorch.org/us=
er_avatar/discuss.pytorch.org/ptrblck/90/1823_2.png" loading=3D"lazy" class=
=3D"avatar"></a></div></div><div class=3D"topic-body clearfix"><div role=3D=
"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=3D"names tr=
igger-user-card"><span class=3D"first username staff admin moderator"><a hr=
ef=3D"https://discuss.pytorch.org/u/ptrblck" data-user-card=3D"ptrblck" cla=
ss=3D"">ptrblck</a><span title=3D"This user is a moderator" class=3D"svg-ic=
on-title"><svg class=3D"fa d-icon d-icon-shield-alt svg-icon svg-node" aria=
-hidden=3D"true"><use xlink:href=3D"#shield-alt"></use></svg></span></span>=
</div><div class=3D"post-infos"><div class=3D"post-info post-date"><a class=
=3D"post-date"><span title=3D"Feb 2, 2020 9:22 am" data-time=3D"15806065796=
37" data-format=3D"tiny" class=3D"relative-date">Feb '20</span></a></div><d=
iv class=3D"read-state read" title=3D"Post is unread"><svg class=3D"fa d-ic=
on d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D=
"#circle"></use></svg></div></div></div><div class=3D"regular contents"><di=
v class=3D"cooked"><p>Your current code snippet will create patches with th=
e length of 5 samples and a stride of 1.<br>
Since dim2 has 10 values, you will end up with 6 patches.<br>
Simplified explanation</p>
<pre><code class=3D"lang-python hljs">data =3D torch.arange(<span class=3D"=
hljs-number">10</span>).view(<span class=3D"hljs-number">1</span>, <span cl=
ass=3D"hljs-number">1</span>, <span class=3D"hljs-number">10</span>).<span =
class=3D"hljs-built_in">float</span>()
patches =3D data.unfold(<span class=3D"hljs-number">2</span>, <span class=
=3D"hljs-number">5</span>, <span class=3D"hljs-number">1</span>)
<span class=3D"hljs-built_in">print</span>(patches)
> tensor([[[[<span class=3D"hljs-number">0.</span>, <span class=3D"hljs-=
number">1.</span>, <span class=3D"hljs-number">2.</span>, <span class=3D"hl=
js-number">3.</span>, <span class=3D"hljs-number">4.</span>],
[<span class=3D"hljs-number">1.</span>, <span class=3D"hljs-numbe=
r">2.</span>, <span class=3D"hljs-number">3.</span>, <span class=3D"hljs-nu=
mber">4.</span>, <span class=3D"hljs-number">5.</span>],
[<span class=3D"hljs-number">2.</span>, <span class=3D"hljs-numbe=
r">3.</span>, <span class=3D"hljs-number">4.</span>, <span class=3D"hljs-nu=
mber">5.</span>, <span class=3D"hljs-number">6.</span>],
[<span class=3D"hljs-number">3.</span>, <span class=3D"hljs-numbe=
r">4.</span>, <span class=3D"hljs-number">5.</span>, <span class=3D"hljs-nu=
mber">6.</span>, <span class=3D"hljs-number">7.</span>],
[<span class=3D"hljs-number">4.</span>, <span class=3D"hljs-numbe=
r">5.</span>, <span class=3D"hljs-number">6.</span>, <span class=3D"hljs-nu=
mber">7.</span>, <span class=3D"hljs-number">8.</span>],
[<span class=3D"hljs-number">5.</span>, <span class=3D"hljs-numbe=
r">6.</span>, <span class=3D"hljs-number">7.</span>, <span class=3D"hljs-nu=
mber">8.</span>, <span class=3D"hljs-number">9.</span>]]]])
</code></pre>
<aside class=3D"quote no-group" data-post=3D"3" data-topic=3D"68211">
<div class=3D"title" style=3D"cursor: pointer;">
<div class=3D"quote-controls"><button aria-controls=3D"quote-id-68211-3-0" =
aria-expanded=3D"false" class=3D"quote-toggle btn-flat"><span class=3D"svg-=
icon-title" title=3D"expand/collapse"><svg class=3D"fa d-icon d-icon-chevro=
n-down svg-icon svg-string" xmlns=3D"http://www.w3.org/2000/svg"><use href=
=3D"#chevron-down"></use></svg></span></button><a href=3D"https://discuss.p=
ytorch.org/t/how-to-implement-a-convolutional-layer/68211/3" title=3D"go to=
the quoted post" class=3D"btn-flat back"><svg class=3D"fa d-icon d-icon-ar=
row-up svg-icon svg-string" xmlns=3D"http://www.w3.org/2000/svg"><use href=
=3D"#arrow-up"></use></svg></a></div>
<img alt=3D"" width=3D"20" height=3D"20" src=3D"https://discuss.pytorch.org=
/letter_avatar_proxy/v4/letter/m/e47c2d/40.png" class=3D"avatar"> madarax64=
:</div>
<blockquote id=3D"quote-id-68211-3-0">
<p>If the filter itself was to have trainable weights (just like traditiona=
l convolution), then I would have to declare the filter as being a Tensor, =
right?</p>
</blockquote>
</aside>
<p>You could define it as a tensor with <code>requires_grad=3DTrue</code> o=
r directly as <code>nn.Parameter(torch.randn(...))</code> and pass it to yo=
ur optimizer.</p></div><section class=3D"post-menu-area clearfix"><nav clas=
s=3D"post-controls expanded"><div class=3D"actions"><div class=3D"double-bu=
tton"><button class=3D"widget-button btn-flat toggle-like like no-text btn-=
icon" title=3D"like this post" data-post-id=3D"162719"><svg class=3D"fa d-i=
con d-icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:hre=
f=3D"#far-heart"></use></svg></button></div><button class=3D"widget-button =
btn-flat share no-text btn-icon" title=3D"share a link to this post"><svg c=
lass=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"tru=
e"><use xlink:href=3D"#link"></use></svg></button></div></nav></section></d=
iv><section class=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"topic-post clearfix topic-owner regular"><article id=
=3D"post_5" aria-label=3D"post #5 by @madarax64" role=3D"region" data-post-=
id=3D"163068" data-topic-id=3D"68211" data-user-id=3D"10151" class=3D"boxed=
onscreen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"=
></span><div class=3D"row"><div class=3D"topic-avatar"><div class=3D"post-a=
vatar"><a class=3D"trigger-user-card main-avatar " href=3D"https://discuss.=
pytorch.org/u/madarax64" data-user-card=3D"madarax64" aria-hidden=3D"true" =
tabindex=3D"-1"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://dis=
cuss.pytorch.org/letter_avatar_proxy/v4/letter/m/e47c2d/90.png" loading=3D"=
lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfix"><=
div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=
=3D"names trigger-user-card"><span class=3D"first username"><a href=3D"http=
s://discuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"=
">madarax64</a></span><span class=3D"second full-name"><a href=3D"https://d=
iscuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"">M.B=
.</a></span></div><div class=3D"post-infos"><div class=3D"post-info post-da=
te"><a class=3D"post-date"><span title=3D"Feb 4, 2020 4:13 am" data-time=3D=
"1580760817394" data-format=3D"tiny" class=3D"relative-date">Feb '20</span>=
</a></div><div class=3D"read-state read" title=3D"Post is unread"><svg clas=
s=3D"fa d-icon d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><use x=
link:href=3D"#circle"></use></svg></div></div></div><div class=3D"regular c=
ontents"><div class=3D"cooked"><p>Hello <a class=3D"mention" href=3D"https:=
//discuss.pytorch.org/u/ptrblck">@ptrblck</a>,<br>
Many thanks, this has cleared it up beautifully for me. I really appreciate=
it.</p>
<p>Thanks again!</p></div><section class=3D"post-menu-area clearfix"><nav c=
lass=3D"post-controls expanded"><div class=3D"actions"><div class=3D"double=
-button"><button class=3D"widget-button btn-flat button-count like-count hi=
ghlight-action regular-likes btn-text" title=3D"1 person liked this post" a=
ria-label=3D"1 person liked this post. Click to view" aria-pressed=3D"false=
">1</button><button class=3D"widget-button btn-flat toggle-like like no-tex=
t btn-icon" title=3D"like this post" data-post-id=3D"163068"><svg class=3D"=
fa d-icon d-icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xli=
nk:href=3D"#far-heart"></use></svg></button></div><button class=3D"widget-b=
utton btn-flat share no-text btn-icon" title=3D"share a link to this post">=
<svg class=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=
=3D"true"><use xlink:href=3D"#link"></use></svg></button></div></nav></sect=
ion></div><section class=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"topic-post clearfix topic-owner regular"><article id=
=3D"post_6" aria-label=3D"post #6 by @madarax64" role=3D"region" data-post-=
id=3D"165154" data-topic-id=3D"68211" data-user-id=3D"10151" class=3D"boxed=
onscreen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"=
></span><div class=3D"row"><div class=3D"topic-avatar"><div class=3D"post-a=
vatar"><a class=3D"trigger-user-card main-avatar " href=3D"https://discuss.=
pytorch.org/u/madarax64" data-user-card=3D"madarax64" aria-hidden=3D"true" =
tabindex=3D"-1"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://dis=
cuss.pytorch.org/letter_avatar_proxy/v4/letter/m/e47c2d/90.png" loading=3D"=
lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfix"><=
div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=
=3D"names trigger-user-card"><span class=3D"first username"><a href=3D"http=
s://discuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"=
">madarax64</a></span><span class=3D"second full-name"><a href=3D"https://d=
iscuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D"">M.B=
.</a></span></div><div class=3D"post-infos"><div class=3D"post-info post-da=
te"><a class=3D"post-date"><span title=3D"Feb 12, 2020 12:01 am" data-time=
=3D"1581436866009" data-format=3D"tiny" class=3D"relative-date">Feb '20</sp=
an></a></div><div class=3D"read-state read" title=3D"Post is unread"><svg c=
lass=3D"fa d-icon d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><us=
e xlink:href=3D"#circle"></use></svg></div></div></div><div class=3D"regula=
r contents"><div class=3D"cooked"><p>Hello <a class=3D"mention" href=3D"htt=
ps://discuss.pytorch.org/u/ptrblck">@ptrblck</a>,<br>
I feel really weird asking you this=E2=80=A6but could I trouble you to plea=
se provide an implementation of a simple 1D CNN using the <code>unfold()</c=
ode> method as you=E2=80=99ve described it. I seem to have difficulty grasp=
ing how to wrangle using multiple trainable filters=E2=80=A6<br>
I=E2=80=99d really appreciate it if you could do this for me=E2=80=A6<br>
Sorry for the trouble again.<br>
Regards</p></div><section class=3D"post-menu-area clearfix"><nav class=3D"p=
ost-controls expanded"><div class=3D"actions"><div class=3D"double-button">=
<button class=3D"widget-button btn-flat toggle-like like no-text btn-icon" =
title=3D"like this post" data-post-id=3D"165154"><svg class=3D"fa d-icon d-=
icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=3D"#=
far-heart"></use></svg></button></div><button class=3D"widget-button btn-fl=
at share no-text btn-icon" title=3D"share a link to this post"><svg class=
=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"true"><=
use xlink:href=3D"#link"></use></svg></button></div></nav></section></div><=
section class=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"topic-post clearfix regular sticky-avatar"><article id=
=3D"post_7" aria-label=3D"post #7 by @ptrblck" role=3D"region" data-post-id=
=3D"165297" data-topic-id=3D"68211" data-user-id=3D"3534" class=3D"boxed on=
screen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"></=
span><div class=3D"row"><div class=3D"topic-avatar"><div class=3D"post-avat=
ar"><a class=3D"trigger-user-card main-avatar " href=3D"https://discuss.pyt=
orch.org/u/ptrblck" data-user-card=3D"ptrblck" aria-hidden=3D"true" tabinde=
x=3D"-1"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://discuss.py=
torch.org/user_avatar/discuss.pytorch.org/ptrblck/90/1823_2.png" loading=3D=
"lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfix">=
<div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=
=3D"names trigger-user-card"><span class=3D"first username staff admin mode=
rator"><a href=3D"https://discuss.pytorch.org/u/ptrblck" data-user-card=3D"=
ptrblck" class=3D"">ptrblck</a><span title=3D"This user is a moderator" cla=
ss=3D"svg-icon-title"><svg class=3D"fa d-icon d-icon-shield-alt svg-icon sv=
g-node" aria-hidden=3D"true"><use xlink:href=3D"#shield-alt"></use></svg></=
span></span></div><div class=3D"post-infos"><div class=3D"post-info post-da=
te"><a class=3D"post-date"><span title=3D"Feb 12, 2020 2:33 pm" data-time=
=3D"1581489191887" data-format=3D"tiny" class=3D"relative-date">Feb '20</sp=
an></a></div><div class=3D"read-state read" title=3D"Post is unread"><svg c=
lass=3D"fa d-icon d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><us=
e xlink:href=3D"#circle"></use></svg></div></div></div><div class=3D"regula=
r contents"><div class=3D"cooked"><p>Sure!<br>
Here you can find a manual 2D conv implementation.<br>
The 1D case should be straightforward by removing a spatial dimension:</p>
<pre><code class=3D"lang-python hljs">batch_size =3D <span class=3D"hljs-nu=
mber">2</span>
channels =3D <span class=3D"hljs-number">5</span>
h, w =3D <span class=3D"hljs-number">12</span>, <span class=3D"hljs-number"=
>12</span>
image =3D torch.randn(batch_size, channels, h, w) <span class=3D"hljs-comme=
nt"># input image</span>
kh, kw =3D <span class=3D"hljs-number">3</span>, <span class=3D"hljs-number=
">3</span> <span class=3D"hljs-comment"># kernel size</span>
dh, dw =3D <span class=3D"hljs-number">3</span>, <span class=3D"hljs-number=
">3</span> <span class=3D"hljs-comment"># stride</span>
<span class=3D"hljs-comment"># Create conv</span>
conv =3D nn.Conv2d(<span class=3D"hljs-number">5</span>, <span class=3D"hlj=
s-number">7</span>, (kh, kw), stride=3D(dh, dw), bias=3D<span class=3D"hljs=
-literal">False</span>)
filt =3D conv.weight
<span class=3D"hljs-comment"># Manual approach</span>
patches =3D image.unfold(<span class=3D"hljs-number">2</span>, kh, dh).unfo=
ld(<span class=3D"hljs-number">3</span>, kw, dw)
<span class=3D"hljs-built_in">print</span>(patches.shape) <span class=3D"hl=
js-comment"># batch_size, channels, h_windows, w_windows, kh, kw</span>
patches =3D patches.contiguous().view(batch_size, channels, -<span class=3D=
"hljs-number">1</span>, kh, kw)
<span class=3D"hljs-built_in">print</span>(patches.shape) <span class=3D"hl=
js-comment"># batch_size, channels, windows, kh, kw</span>
nb_windows =3D patches.size(<span class=3D"hljs-number">2</span>)
<span class=3D"hljs-comment"># Now we have to shift the windows into the ba=
tch dimension.</span>
<span class=3D"hljs-comment"># Maybe there is another way without .permute,=
but this should work</span>
patches =3D patches.permute(<span class=3D"hljs-number">0</span>, <span cla=
ss=3D"hljs-number">2</span>, <span class=3D"hljs-number">1</span>, <span cl=
ass=3D"hljs-number">3</span>, <span class=3D"hljs-number">4</span>)
<span class=3D"hljs-built_in">print</span>(patches.shape) <span class=3D"hl=
js-comment"># batch_size, nb_windows, channels, kh, kw</span>
<span class=3D"hljs-comment"># Calculate the conv operation manually</span>
res =3D (patches.unsqueeze(<span class=3D"hljs-number">2</span>) * filt.uns=
queeze(<span class=3D"hljs-number">0</span>).unsqueeze(<span class=3D"hljs-=
number">1</span>)).<span class=3D"hljs-built_in">sum</span>([<span class=3D=
"hljs-number">3</span>, <span class=3D"hljs-number">4</span>, <span class=
=3D"hljs-number">5</span>])
<span class=3D"hljs-built_in">print</span>(res.shape) <span class=3D"hljs-c=
omment"># batch_size, output_pixels, out_channels</span>
res =3D res.permute(<span class=3D"hljs-number">0</span>, <span class=3D"hl=
js-number">2</span>, <span class=3D"hljs-number">1</span>) <span class=3D"h=
ljs-comment"># batch_size, out_channels, output_pixels</span>
<span class=3D"hljs-comment"># assuming h =3D w</span>
h =3D w =3D <span class=3D"hljs-built_in">int</span>(res.size(<span class=
=3D"hljs-number">2</span>)**<span class=3D"hljs-number">0.5</span>)
res =3D res.view(batch_size, -<span class=3D"hljs-number">1</span>, h, w)
<span class=3D"hljs-comment"># Module approach</span>
out =3D conv(image)
<span class=3D"hljs-built_in">print</span>(<span class=3D"hljs-string">'max=
abs error '</span>, (out - res).<span class=3D"hljs-built_in">abs</span>()=
.<span class=3D"hljs-built_in">max</span>())
> <span class=3D"hljs-built_in">max</span> <span class=3D"hljs-built_in"=
>abs</span> error tensor(<span class=3D"hljs-number">3.5763e-07</span>, gr=
ad_fn=3D<MaxBackward1>)
</code></pre></div><section class=3D"post-menu-area clearfix"><nav class=3D=
"post-controls expanded"><div class=3D"actions"><div class=3D"double-button=
"><button class=3D"widget-button btn-flat button-count like-count highlight=
-action regular-likes btn-text" title=3D"2 people liked this post" aria-lab=
el=3D"2 people liked this post. Click to view" aria-pressed=3D"false">2</bu=
tton><button class=3D"widget-button btn-flat toggle-like like no-text btn-i=
con" title=3D"like this post" data-post-id=3D"165297"><svg class=3D"fa d-ic=
on d-icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:href=
=3D"#far-heart"></use></svg></button></div><button class=3D"widget-button b=
tn-flat share no-text btn-icon" title=3D"share a link to this post"><svg cl=
ass=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"true=
"><use xlink:href=3D"#link"></use></svg></button></div></nav></section></di=
v><section class=3D"post-actions">
</section><div class=3D"post-links-container"><ul class=3D"post-links"><l=
i><a class=3D"track-link inbound" href=3D"https://discuss.pytorch.org/t/how=
-to-split-tensors-with-overlap-and-then-reconstruct-the-original-tensor/702=
61/5"><svg class=3D"fa d-icon d-icon-link svg-icon svg-node" aria-hidden=3D=
"true"><use xlink:href=3D"#link"></use></svg><span>How to split tensors wit=
h overlap and then reconstruct the original tensor?</span><span class=3D"ba=
dge badge-notification clicks">5</span></a></li></ul></div></div></div></ar=
ticle></div><div class=3D"topic-post clearfix topic-owner regular"><article=
id=3D"post_8" aria-label=3D"post #8 by @madarax64" role=3D"region" data-po=
st-id=3D"165642" data-topic-id=3D"68211" data-user-id=3D"10151" class=3D"bo=
xed onscreen-post"><span aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabL=
oc"></span><div class=3D"row"><div class=3D"topic-avatar"><div class=3D"pos=
t-avatar"><a class=3D"trigger-user-card main-avatar " href=3D"https://discu=
ss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" aria-hidden=3D"tru=
e" tabindex=3D"-1"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://=
discuss.pytorch.org/letter_avatar_proxy/v4/letter/m/e47c2d/90.png" loading=
=3D"lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfi=
x"><div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div cl=
ass=3D"names trigger-user-card"><span class=3D"first username"><a href=3D"h=
ttps://discuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=
=3D"">madarax64</a></span><span class=3D"second full-name"><a href=3D"https=
://discuss.pytorch.org/u/madarax64" data-user-card=3D"madarax64" class=3D""=
>M.B.</a></span></div><div class=3D"post-infos"><div class=3D"post-info pos=
t-date"><a class=3D"post-date"><span title=3D"Feb 13, 2020 4:09 pm" data-ti=
me=3D"1581581342078" data-format=3D"tiny" class=3D"relative-date">Feb '20</=
span></a></div><div class=3D"read-state read" title=3D"Post is unread"><svg=
class=3D"fa d-icon d-icon-circle svg-icon svg-node" aria-hidden=3D"true"><=
use xlink:href=3D"#circle"></use></svg></div></div></div><div class=3D"regu=
lar contents"><div class=3D"cooked"><p>Hello <a class=3D"mention" href=3D"h=
ttps://discuss.pytorch.org/u/ptrblck">@ptrblck</a>,<br>
Thank you so much for this! I was able to modify the code appropriately to =
suit my 1D case and it seems to work quite nicely. Many thanks for your hel=
p. Really appreciate it.</p>
<p>Best Regards</p></div><section class=3D"post-menu-area clearfix"><nav cl=
ass=3D"post-controls expanded"><div class=3D"actions"><div class=3D"double-=
button"><button class=3D"widget-button btn-flat toggle-like like no-text bt=
n-icon" title=3D"like this post" data-post-id=3D"165642"><svg class=3D"fa d=
-icon d-icon-d-unliked svg-icon svg-node" aria-hidden=3D"true"><use xlink:h=
ref=3D"#far-heart"></use></svg></button></div><button class=3D"widget-butto=
n btn-flat share no-text btn-icon" title=3D"share a link to this post"><svg=
class=3D"fa d-icon d-icon-d-post-share svg-icon svg-node" aria-hidden=3D"t=
rue"><use xlink:href=3D"#link"></use></svg></button></div></nav></section><=
/div><section class=3D"post-actions">
</section><div class=3D"post-links-container"></div></div></div></article=
></div><div class=3D"time-gap small-action"><div class=3D"topic-avatar"></d=
iv><div class=3D"small-action-desc timegap">7 months later</div></div><div =
class=3D"topic-post clearfix regular"><article id=3D"post_9" aria-label=3D"=
post #9 by @Poornima_Jain" role=3D"region" data-post-id=3D"228280" data-top=
ic-id=3D"68211" data-user-id=3D"15809" class=3D"boxed onscreen-post"><span =
aria-hidden=3D"true" tabindex=3D"-1" class=3D"tabLoc"></span><div class=3D"=
row"><div class=3D"topic-avatar"><div class=3D"post-avatar"><a class=3D"tri=
gger-user-card main-avatar " href=3D"https://discuss.pytorch.org/u/Poornima=
_Jain" data-user-card=3D"Poornima_Jain" aria-hidden=3D"true" tabindex=3D"-1=
"><img alt=3D"" width=3D"45" height=3D"45" src=3D"https://discuss.pytorch.o=
rg/user_avatar/discuss.pytorch.org/poornima_jain/90/14833_2.png" loading=3D=
"lazy" class=3D"avatar"></a></div></div><div class=3D"topic-body clearfix">=
<div role=3D"heading" aria-level=3D"2" class=3D"topic-meta-data"><div class=
=3D"names trigger-user-card"><span class=3D"first username"><a href=3D"http=
s://discuss.pytorch.org/u/Poornima_Jain" data-user-card=3D"Poornima_Jain" c=
lass=3D"">Poornima_Jain</a></span></div><div class=3D"post-infos"><div clas=
s=3D"post-info post-date"><a class=3D"post-date"><span title=3D"Sep 12, 202=
0 5:57 pm" data-time=3D"1599904635844" data-format=3D"tiny" class=3D"relati=