PyTransformer icon indicating copy to clipboard operation
PyTransformer copied to clipboard

TypeError: object of type '_ReplaceFunc' has no len()

Open sh7jacobi opened this issue 3 years ago • 1 comments

I have following error: if (len(logs) > 1) and (type(logs[0]) == torch.Tensor): TypeError: object of type '_ReplaceFunc' has no len() when I run: from PyTransformer.transformers.torchTransformer import TorchTransformer transformer = TorchTransformer() dot = transformer.visualize(self.base_layer, input_tensor = x.detach(), save_name = "/datasets/fig")

sh7jacobi avatar Apr 29 '21 11:04 sh7jacobi

I have the same error for Sequential: nn.Sequential( nn.Conv2d(3, 6, kernel_size=7, stride=1, padding=3, bias=False), nn.BatchNorm2d(6, momentum=0.1), nn.ReLU(inplace=True)) I have removed Batch normalization layer and the error disappered. I guess it incorrectly process with some layers, particularly with BatchNorm layer.

sh7jacobi avatar Apr 29 '21 11:04 sh7jacobi