Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError in Multibidder.ipynb #4

Open
matthew-mcateer opened this issue Jan 23, 2020 · 0 comments
Open

ValueError in Multibidder.ipynb #4

matthew-mcateer opened this issue Jan 23, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@matthew-mcateer
Copy link
Collaborator

When the final cell in the notebook is run, the following error comes up:

WARNING:tensorflow:From /content/utils_moe.py:487: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From /content/utils_moe.py:489: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From /content/utils_moe.py:499: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From /content/utils_moe.py:501: The name tf.random_normal is deprecated. Please use tf.random.normal instead.

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensor2tensor/layers/common_layers.py:3413: The name tf.get_variable_scope is deprecated. Please use tf.compat.v1.get_variable_scope instead.

WARNING:tensorflow:From /content/utils_moe.py:504: The name tf.summary.histogram is deprecated. Please use tf.compat.v1.summary.histogram instead.

WARNING:tensorflow:From /content/utils_moe.py:386: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From /content/utils_moe.py:249: div (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Deprecated in favor of operator or tf.math.divide.
WARNING:tensorflow:From /content/utils_moe.py:250: The name tf.unsorted_segment_sum is deprecated. Please use tf.math.unsorted_segment_sum instead.

WARNING:tensorflow:From /content/utils_moe.py:846: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1606   try:
-> 1607     c_op = c_api.TF_FinishOperation(op_desc)
   1608   except errors.InvalidArgumentError as e:

InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1].
	From merging shape 0 with other shapes. for 'Slice/input' (op: 'Pack') with input shapes: [4], [1].

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
27 frames
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    527                 as_ref=input_arg.is_ref,
--> 528                 preferred_dtype=default_dtype)
    529           except TypeError as err:

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accepted_result_types)
   1296     if ret is None:
-> 1297       ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
   1298 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/array_ops.py in _autopacking_conversion_function(v, dtype, name, as_ref)
   1266     v = nest.map_structure(_cast_nested_seqs_to_dtype(dtype), v)
-> 1267   return _autopacking_helper(v, dtype, name or "packed")
   1268 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/array_ops.py in _autopacking_helper(list_or_tuple, dtype, name)
   1202               constant_op.constant(elem, dtype=dtype, name=str(i)))
-> 1203       return gen_array_ops.pack(elems_as_tensors, name=scope)
   1204     else:

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_array_ops.py in pack(values, axis, name)
   6302   _, _, _op = _op_def_lib._apply_op_helper(
-> 6303         "Pack", values=values, axis=axis, name=name)
   6304   _result = _op.outputs[:]

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    793                          input_types=input_types, attrs=attr_protos,
--> 794                          op_def=op_def)
    795 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/util/deprecation.py in new_func(*args, **kwargs)
    506                 instructions)
--> 507       return func(*args, **kwargs)
    508 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in create_op(***failed resolving arguments***)
   3356     return self._create_op_internal(op_type, inputs, dtypes, input_types, name,
-> 3357                                     attrs, op_def, compute_device)
   3358 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
   3425           original_op=self._default_original_op,
-> 3426           op_def=op_def)
   3427       self._create_op_helper(ret, compute_device=compute_device)

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1769       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
-> 1770                                 control_input_ops)
   1771     # pylint: enable=protected-access

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1609     # Convert to ValueError for backwards compatibility.
-> 1610     raise ValueError(str(e))
   1611 

ValueError: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1].
	From merging shape 0 with other shapes. for 'Slice/input' (op: 'Pack') with input shapes: [4], [1].

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1606   try:
-> 1607     c_op = c_api.TF_FinishOperation(op_desc)
   1608   except errors.InvalidArgumentError as e:

InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1].
	From merging shape 0 with other shapes. for 'Slice/packed' (op: 'Pack') with input shapes: [4], [1].

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    541               observed = ops.internal_convert_to_tensor(
--> 542                   values, as_ref=input_arg.is_ref).dtype.name
    543             except ValueError as err:

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accepted_result_types)
   1296     if ret is None:
-> 1297       ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
   1298 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/array_ops.py in _autopacking_conversion_function(v, dtype, name, as_ref)
   1266     v = nest.map_structure(_cast_nested_seqs_to_dtype(dtype), v)
-> 1267   return _autopacking_helper(v, dtype, name or "packed")
   1268 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/array_ops.py in _autopacking_helper(list_or_tuple, dtype, name)
   1202               constant_op.constant(elem, dtype=dtype, name=str(i)))
-> 1203       return gen_array_ops.pack(elems_as_tensors, name=scope)
   1204     else:

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_array_ops.py in pack(values, axis, name)
   6302   _, _, _op = _op_def_lib._apply_op_helper(
-> 6303         "Pack", values=values, axis=axis, name=name)
   6304   _result = _op.outputs[:]

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    793                          input_types=input_types, attrs=attr_protos,
--> 794                          op_def=op_def)
    795 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/util/deprecation.py in new_func(*args, **kwargs)
    506                 instructions)
--> 507       return func(*args, **kwargs)
    508 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in create_op(***failed resolving arguments***)
   3356     return self._create_op_internal(op_type, inputs, dtypes, input_types, name,
-> 3357                                     attrs, op_def, compute_device)
   3358 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
   3425           original_op=self._default_original_op,
-> 3426           op_def=op_def)
   3427       self._create_op_helper(ret, compute_device=compute_device)

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1769       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
-> 1770                                 control_input_ops)
   1771     # pylint: enable=protected-access

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1609     # Convert to ValueError for backwards compatibility.
-> 1610     raise ValueError(str(e))
   1611 

ValueError: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1].
	From merging shape 0 with other shapes. for 'Slice/packed' (op: 'Pack') with input shapes: [4], [1].

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-5-62d2bca779d9> in <module>()
     18 session = tf.Session(graph=graph)
     19 with graph.as_default():
---> 20     train_step, metrics = model_fn(hparams)
     21     session.run(tf.global_variables_initializer())
     22 

<ipython-input-4-f3fe435f58fc> in model_fn(hparams)
     26         weights = tf.linalg.normalize(tf.concat([self_weight, importance], axis=0))
     27 
---> 28         revenue = tf.slice(weights, [0], [1])
     29 
     30         # Save references.

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/array_ops.py in slice(input_, begin, size, name)
    853     A `Tensor` the same type as `input_`.
    854   """
--> 855   return gen_array_ops._slice(input_, begin, size, name=name)
    856 
    857 

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_array_ops.py in _slice(input, begin, size, name)
   9220   # Add nodes to the TensorFlow graph.
   9221   _, _, _op = _op_def_lib._apply_op_helper(
-> 9222         "Slice", input=input, begin=begin, size=size, name=name)
   9223   _result = _op.outputs[:]
   9224   _inputs_flat = _op.inputs

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    544               raise ValueError(
    545                   "Tried to convert '%s' to a tensor and failed. Error: %s" %
--> 546                   (input_name, err))
    547             prefix = ("Input '%s' of '%s' Op has type %s that does not match" %
    548                       (input_name, op_type_name, observed))

ValueError: Tried to convert 'input' to a tensor and failed. Error: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1].
	From merging shape 0 with other shapes. for 'Slice/packed' (op: 'Pack') with input shapes: [4], [1].
@matthew-mcateer matthew-mcateer added the bug Something isn't working label Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants