DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

Pytorch Internals

原文链接

The purpose of this talk is to put a map in your hands: to tell you about the basic conceptual structure of a “tensor library that supports automatic differentiation”, and give you some tools and tricks for finding your way around the codebase.

tensor

image-20200521140633255

strides,跟物理内存有关,跟实际元素的使用有关

image-20200521141246243

Every tensor records an offset, but most of the time it’s zero, and I’ll omit it from my diagrams when that’s the case.

stride !=1 means we skip elements

stride visualizer

tensor是一个logic view

extensions
image-20200521142040136

分层,针对自己想要加的

autograd

image-20200521142935547

source

image-20200521143041600 image-20200521143541802

按照这个层次和流程,通过pytorch operator来改写