Skip to content

Instantly share code, notes, and snippets.

@YatinAdityaT
Created April 25, 2020 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YatinAdityaT/e9b89236fee119d6726e535785198423 to your computer and use it in GitHub Desktop.
Save YatinAdityaT/e9b89236fee119d6726e535785198423 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\eager\context.py in __enter__(self)
1508 try:
-> 1509 new_device_name, new_device_spec = _device_parsing_cache[cache_key]
1510 except TypeError:
KeyError: ('', '/job:localhost/replica:0/task:0/device:GPU:0')
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
526 as_ref=input_arg.is_ref,
--> 527 preferred_dtype=default_dtype)
528 except TypeError as err:
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\framework\ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accept_composite_tensors)
1295 if ret is None:
-> 1296 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1297
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py in _dense_var_to_tensor(var, dtype, name, as_ref)
1788 def _dense_var_to_tensor(var, dtype=None, name=None, as_ref=False):
-> 1789 return var._dense_var_to_tensor(dtype=dtype, name=name, as_ref=as_ref) # pylint: disable=protected-access
1790
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py in _dense_var_to_tensor(***failed resolving arguments***)
1213 else:
-> 1214 return self.value()
1215
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py in value(self)
522 with ops.colocate_with(None, ignore_existing=True):
--> 523 with ops.device(self._handle.device):
524 return self._read_variable_op()
~\.conda\envs\gpu2\lib\contextlib.py in __enter__(self)
111 try:
--> 112 return next(self.gen)
113 except StopIteration:
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\framework\ops.py in combined(device_name_or_function)
5137 if not callable(device_name_or_function):
-> 5138 with context.device(device_name_or_function):
5139 yield
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\eager\context.py in __enter__(self)
1525 new_device_spec = pydev.DeviceSpec.from_string(
-> 1526 ctx._context_devices[0]) # pylint: disable=protected-access
1527 new_device_spec = new_device_spec.make_merged_spec(device_spec)
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-11-1a87c6240309> in <module>
1 if __name__ == '__main__':
----> 2 load_data()
3
<ipython-input-10-8f0b4bf7265c> in load_data()
1 def load_data():
----> 2 data_loader = Dataloader(r'Fight-Detection/images',['Violence','NonViolence'],40,(224,224),3,r'Fight-Detection\images\saving_things')
3 x_val,y_val = data_loader.get_all_sequence_in_memory()
<ipython-input-2-56a78c44df72> in __init__(self, datapath, classes, max_frames, img_shape, channels, saving_dir)
7 self.width = img_shape[1]
8 self.channels = channels
----> 9 self.model = ResNet152(include_top = False,input_shape=(224,224,3),weights = 'imagenet')
10
11 for layer in self.model.layers:
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\keras\applications\__init__.py in wrapper(*args, **kwargs)
47 kwargs['models'] = models
48 kwargs['utils'] = utils
---> 49 return base_fun(*args, **kwargs)
50 return wrapper
51
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\keras\applications\resnet.py in ResNet152(*args, **kwargs)
45 @keras_modules_injection
46 def ResNet152(*args, **kwargs):
---> 47 return resnet.ResNet152(*args, **kwargs)
48
49
~\.conda\envs\gpu2\lib\site-packages\keras_applications\resnet_common.py in ResNet152(include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
473 input_tensor, input_shape,
474 pooling, classes,
--> 475 **kwargs)
476
477
~\.conda\envs\gpu2\lib\site-packages\keras_applications\resnet_common.py in ResNet(stack_fn, preact, use_bias, model_name, include_top, weights, input_tensor, input_shape, pooling, classes, **kwargs)
361
362 x = layers.ZeroPadding2D(padding=((3, 3), (3, 3)), name='conv1_pad')(img_input)
--> 363 x = layers.Conv2D(64, 7, strides=2, use_bias=use_bias, name='conv1_conv')(x)
364
365 if preact is False:
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py in __call__(self, inputs, *args, **kwargs)
840 not base_layer_utils.is_in_eager_or_tf_function()):
841 with auto_control_deps.AutomaticControlDependencies() as acd:
--> 842 outputs = call_fn(cast_inputs, *args, **kwargs)
843 # Wrap Tensors in `outputs` in `tf.identity` to avoid
844 # circular dependencies.
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\keras\layers\convolutional.py in call(self, inputs)
195
196 def call(self, inputs):
--> 197 outputs = self._convolution_op(inputs, self.kernel)
198
199 if self.use_bias:
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\nn_ops.py in __call__(self, inp, filter)
1132 call_from_convolution=False)
1133 else:
-> 1134 return self.conv_op(inp, filter)
1135 # copybara:strip_end
1136 # copybara:insert return self.conv_op(inp, filter)
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\nn_ops.py in __call__(self, inp, filter)
637
638 def __call__(self, inp, filter): # pylint: disable=redefined-builtin
--> 639 return self.call(inp, filter)
640
641
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\nn_ops.py in __call__(self, inp, filter)
236 padding=self.padding,
237 data_format=self.data_format,
--> 238 name=self.name)
239
240
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\nn_ops.py in conv2d(input, filter, strides, padding, use_cudnn_on_gpu, data_format, dilations, name, filters)
2008 data_format=data_format,
2009 dilations=dilations,
-> 2010 name=name)
2011
2012
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\ops\gen_nn_ops.py in conv2d(input, filter, strides, padding, use_cudnn_on_gpu, explicit_paddings, data_format, dilations, name)
1069 padding=padding, use_cudnn_on_gpu=use_cudnn_on_gpu,
1070 explicit_paddings=explicit_paddings,
-> 1071 data_format=data_format, dilations=dilations, name=name)
1072 _result = _op.outputs[:]
1073 _inputs_flat = _op.inputs
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
534 "type '%s' instead. Error: %s" %
535 (dtypes.as_dtype(dtype).name, input_arg.name, op_type_name,
--> 536 repr(values), type(values).__name__, err))
537 except ValueError:
538 # What type does convert_to_tensor think it has?
TypeError: Expected float32 passed to parameter 'filter' of op 'Conv2D', got <tf.Variable 'conv1_conv_2/kernel:0' shape=(7, 7, 3, 64) dtype=float32> of type 'ResourceVariable' instead. Error: 'NoneType' object is not subscriptable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment