Skip to content

PureFrameworkTensorFoundError AttributeError: 'Tensor' object has no attribute 'child' #4491

@phenomenal-manish

Description

@phenomenal-manish

After using the .get() function on each tensor in the list of features produced by an UXception encoder model which resides at the client worker(virtual worker on same machine), I pass this list of features through a decoder model. This is when I get the error as stated below.


PureFrameworkTensorFoundError Traceback (most recent call last)
~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in handle_func_command(cls, command)
340 new_args, new_kwargs, new_type, args_type = hook_args.unwrap_args_from_function(
--> 341 cmd, args_, kwargs_, return_args_type=True
342 )

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook_args.py in unwrap_args_from_function(attr, args_, kwargs_, return_args_type)
156 # Try running it
--> 157 new_args = hook_args(args_)
158

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook_args.py in (x)
355
--> 356 return lambda x: f(lambdas, x)
357

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook_args.py in tuple_one_fold(lambdas, args_)
522 def tuple_one_fold(lambdas, args_):
--> 523 return (lambdas[0](args_[0], **kwargs),)
524

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook_args.py in (i)
330 # Last if not, rule is probably == 1 so use type to return the right transformation.
--> 331 else lambda i: forward_functype(i)
332 for a, r in zip(args_, rules) # And do this for all the args / rules provided

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/hook/hook_args.py in (i)
23 if hasattr(i, "child")
---> 24 else (_ for _ in ()).throw(PureFrameworkTensorFoundError),
25 torch.nn.Parameter: lambda i: i.child

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/hook/hook_args.py in (.0)
23 if hasattr(i, "child")
---> 24 else (_ for _ in ()).throw(PureFrameworkTensorFoundError),
25 torch.nn.Parameter: lambda i: i.child

PureFrameworkTensorFoundError:

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in handle_func_command(cls, command)
383 try:
--> 384 response = cls.get_response(cmd, args, kwargs_)
385 except AttributeError:

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in get_response(cmd, args, kwargs_)
417 if isinstance(args_, tuple):
--> 418 response = command_method(*args_, **kwargs_)
419 else:

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/torch/nn/functional.py in interpolate(input, size, scale_factor, mode, align_corners)
2508
-> 2509 if input.dim() == 3 and mode == 'nearest':
2510 return torch._C._nn.upsample_nearest1d(input, _output_size(1))

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_native_method(self, *args, **kwargs)
173 # we can make some errors more descriptive with this method
--> 174 raise route_method_exception(e, self, args, kwargs)
175

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_native_method(self, *args, **kwargs)
169 try:
--> 170 response = method(*args, **kwargs)
171

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/tensors.py in dim(self)
106 def dim(self):
--> 107 return len(self.shape)
108

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in shape(self)
136 if self.is_wrapper:
--> 137 return self.child.shape
138 else:

AttributeError: 'Tensor' object has no attribute 'child'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
in
56
57 #4) make prediction on next model using recieved signal
---> 58 output = server_model(server_a)
59 break
60

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)

in forward(self, features)
47 """Sequentially pass x trough model`s encoder, decoder and heads"""
48 #features = self.encoder(x)
---> 49 decoder_output = self.decoder(*features)
50
51 masks = self.segmentation_head(decoder_output)

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)

in forward(self, *features)
110 for i, decoder_block in enumerate(self.blocks):
111 skip = skips[i] if i < len(skips) else None
--> 112 x = decoder_block(x, skip)
113
114 return x

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)

in forward(self, x, skip)
27
28 def forward(self, x, skip=None):
---> 29 x = F.interpolate(x, scale_factor=2, mode="nearest")
30 if skip is not None:
31 x = torch.cat([x, skip], dim=1)

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_func(*args, **kwargs)
338 handle_func_command = syft.framework.Tensor.handle_func_command
339
--> 340 response = handle_func_command(command)
341
342 return response

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in handle_func_command(cls, command)
386 # Change the library path to avoid errors on layers like AvgPooling
387 cmd = cls.fix_torch_library(cmd)
--> 388 response = cls.get_response(cmd, args, kwargs
)
389
390 return response

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in get_response(cmd, args, kwargs_)
416
417 if isinstance(args_, tuple):
--> 418 response = command_method(*args_, **kwargs_)
419 else:
420 response = command_method(args_, **kwargs_)

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/torch/nn/functional.py in interpolate(input, size, scale_factor, mode, align_corners)
2507 align_corners = False
2508
-> 2509 if input.dim() == 3 and mode == 'nearest':
2510 return torch._C._nn.upsample_nearest1d(input, _output_size(1))
2511 elif input.dim() == 4 and mode == 'nearest':

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_native_method(self, *args, **kwargs)
172 except BaseException as e:
173 # we can make some errors more descriptive with this method
--> 174 raise route_method_exception(e, self, args, kwargs)
175
176 else: # means that there is a wrapper to remove

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/hook.py in overloaded_native_method(self, *args, **kwargs)
168
169 try:
--> 170 response = method(*args, **kwargs)
171
172 except BaseException as e:

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/generic/frameworks/hook/tensors.py in dim(self)
105
106 def dim(self):
--> 107 return len(self.shape)
108
109 tensor_type.dim = dim

~/anaconda3/envs/pysyft/lib/python3.7/site-packages/syft/frameworks/torch/tensors/interpreters/native.py in shape(self)
135 def shape(self):
136 if self.is_wrapper:
--> 137 return self.child.shape
138 else:
139 return self.native_shape

AttributeError: 'Tensor' object has no attribute 'child'

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.2.xRelating to the 0.2.x code branchType: Bug 🐛Some functionality not working in the codebase as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions