def forward(ctx, input): # input 是热力图 # ctx can be seen as the context in which this Function is running. You will get an empty one during the forward that only contains helper functions. The same ctx will be passed to the backward function so you can use it to store stuff for the backward. # It is similar to the self argument when working with python classes. output = top_pool.forward(input)[0] # forward giving a height x width heatmap, and return a tensor with shape(width,) # for each col count which row has the largest value ctx.save_for_backward(input) return output
def forward(ctx, input): output = top_pool.forward(input)[0] ctx.save_for_backward(input) return output
def forward(ctx, input): print(sys.path) output = top_pool.forward(input)[0] ctx.save_for_backward(input) return output