DLS course 5 assignment 3 jass improv dj model

I have this very long error message that I’m not sure about. The pieces of code that i’m most concerned about.(Not necessarily positive they are the culprits for this error message) are when I select the t’th example from X, as in X[Tx, t] I do this because its asking to slice at t in the place of n_a which is the second index of X. I then use x = reshaper(x) but get this error.

How do I open this assignment up brand new? I’m afraid that I have edited some code that was outside of the part I was supposed to mess with. So I’d like to just look at a blank one to make sure everything is still the way its supposed to be.

heres the error. Thanks


InvalidArgumentError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs, op_def)
1811 try:
→ 1812 c_op = pywrap_tf_session.TF_FinishOperation(op_desc)
1813 except errors.InvalidArgumentError as e:

InvalidArgumentError: Cannot reshape a tensor with 90 elements to shape [90,1,90] (8100 elements) for ‘{{node reshape_1/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](strided_slice_1, reshape_1/Reshape/shape)’ with input shapes: [90], [3] and with input tensors computed as partial shapes: input[1] = [90,1,90].

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
----> 1 model = djmodel(Tx=30, LSTM_cell=LSTM_cell, densor=densor, reshaper=reshaper)

in djmodel(Tx, LSTM_cell, densor, reshaper)
42 x = X[Tx, t]
43 # Step 2.B: Use reshaper to reshape x to be (1, n_values) (≈1 line)
—> 44 x = reshaper(x)
45
46 # Step 2.C: Perform one step of the LSTM_cell

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
925 return self._functional_construction_call(inputs, args, kwargs,
→ 926 input_list)
927
928 # Maintains info about the Layer.call stack.

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1115 try:
1116 with ops.enable_auto_cast_variables(self._compute_dtype_object):
→ 1117 outputs = call_fn(cast_inputs, *args, **kwargs)
1118
1119 except errors.OperatorNotAllowedInGraphError as e:

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py in call(self, inputs)
538 def call(self, inputs):
539 result = array_ops.reshape(
→ 540 inputs, (array_ops.shape(inputs)[0],) + self.target_shape)
541 if not context.executing_eagerly():
542 # Set the static shape for the result since it might lost during array_ops

/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”“”
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in reshape(tensor, shape, name)
193 A Tensor. Has the same type as tensor.
194 “”"
→ 195 result = gen_array_ops.reshape(tensor, shape, name)
196 tensor_util.maybe_set_static_shape(result, shape)
197 return result

/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py in reshape(tensor, shape, name)
8232 # Add nodes to the TensorFlow graph.
8233 _, _, _op, _outputs = _op_def_library._apply_op_helper(
→ 8234 “Reshape”, tensor=tensor, shape=shape, name=name)
8235 _result = _outputs[:]
8236 if _execute.must_record_gradient():

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
742 op = g._create_op_internal(op_type_name, inputs, dtypes=None,
743 name=scope, input_types=input_types,
→ 744 attrs=attr_protos, op_def=op_def)
745
746 # outputs is returned as a separate return value so that the output

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
591 return super(FuncGraph, self)._create_op_internal( # pylint: disable=protected-access
592 op_type, inputs, dtypes, input_types, name, attrs, op_def,
→ 593 compute_device)
594
595 def capture(self, tensor, name=None, shape=None):

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
3483 input_types=input_types,
3484 original_op=self._default_original_op,
→ 3485 op_def=op_def)
3486 self._create_op_helper(ret, compute_device=compute_device)
3487 return ret

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in init(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
1973 op_def = self._graph._get_op_def(node_def.op)
1974 self._c_op = _create_c_op(self._graph, node_def, inputs,
→ 1975 control_input_ops, op_def)
1976 name = compat.as_str(node_def.name)
1977 # pylint: enable=protected-access

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs, op_def)
1813 except errors.InvalidArgumentError as e:
1814 # Convert to ValueError for backwards compatibility.
→ 1815 raise ValueError(str(e))
1816
1817 return c_op

ValueError: Cannot reshape a tensor with 90 elements to shape [90,1,90] (8100 elements) for ‘{{node reshape_1/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](strided_slice_1, reshape_1/Reshape/shape)’ with input shapes: [90], [3] and with input tensors computed as partial shapes: input[1] = [90,1,90].

See the first Topic in this FAQ thread:

1 Like

Thanks you for the link!