Will pytorch performs correctly with python calculate codes in net?
Take the fake codes below as an example:

class():
    def forward(input):
        x = some_torch_layers(input)
        x = some_torch_layers(x)
        ...
        x = sum(x) # or numpy or other operations
        x = some_torch_layers(x)
        return x


Will the pytorch net operates well? Especially, while the sum(x) performs well in the backward process.

TL;DR
No.

In order for PyTorch to "perform well" it needs to propagate gradients through the net. PyTorch doesn't (and can't) know how to differentiate an arbtrary numpy code, it can only propagate gradients through PyTorch tensor operations.
In your examples the gradients will stop at the numpy sum so only the top-most torch layers will be trained (layers between numpy operation and the criterion), The other layers (between input and numpy operation) will have zero gradient and therefore their parameters will remain fixed throughout the training.
