Skip to content

Training: ValueError: Cannot reshape a tensor #116

Open
@jstaerk

Description

@jstaerk

Hi,

With this training data r2.zip
I get the following Exception:

2024-03-09 20:22:16.136873: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Exception in thread Thread-106:
Traceback (most recent call last):
  File "C:\ProgramData\anaconda3\envs\invoicenet\lib\threading.py", line 980, in _bootstrap_inner
    self.run()
  File "C:\ProgramData\anaconda3\envs\invoicenet\lib\threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\jstaerk\workspace\InvoiceNet\invoicenet\gui\trainer.py", line 257, in _train
    train_loss = model.train_step(next(train_iter))
  File "C:\ProgramData\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\jstaerk\AppData\Local\Temp\__autograph_generated_file8m_8dtrb.py", line 12, in tf__train_step
    predictions = ag__.converted_call(ag__.ld(self).model, (ag__.ld(inputs),), dict(training=True), fscope)
  File "C:\ProgramData\anaconda3\envs\invoicenet\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\jstaerk\AppData\Local\Temp\__autograph_generated_file_10s7djf.py", line 12, in tf__call
    memories = ag__.converted_call(ag__.ld(tf).sparse.reshape, (ag__.ld(memories), (-1, ag__.ld(InvoiceData).im_size[0] * ag__.ld(InvoiceData).im_size[1] * ag__.ld(InvoiceData).n_memories, ag__.ld(InvoiceData).seq_in, ag__.ld(InvoiceData).n_output)), None, fscope)
ValueError: in user code:

    File "C:\Users\jstaerk\workspace\InvoiceNet\invoicenet\acp\acp.py", line 86, in train_step  *
        predictions = self.model(inputs, training=True)
    File "C:\ProgramData\anaconda3\envs\invoicenet\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler  **
        raise e.with_traceback(filtered_tb) from None
    File "C:\Users\jstaerk\AppData\Local\Temp\__autograph_generated_file_10s7djf.py", line 12, in tf__call
        memories = ag__.converted_call(ag__.ld(tf).sparse.reshape, (ag__.ld(memories), (-1, ag__.ld(InvoiceData).im_size[0] * ag__.ld(InvoiceData).im_size[1] * ag__.ld(InvoiceData).n_memories, ag__.ld(InvoiceData).seq_in, ag__.ld(InvoiceData).n_output)), None, fscope)

    ValueError: Exception encountered when calling layer 'attend_copy_parse_model' (type AttendCopyParseModel).

    in user code:

        File "C:\Users\jstaerk\workspace\InvoiceNet\invoicenet\acp\model.py", line 168, in call  *
            memories = tf.sparse.reshape(memories,

        ValueError: Cannot reshape a tensor with -838860800 elements to shape [None, 65536, 128, 103] (-864026624 elements).


    Call arguments received by layer 'attend_copy_parse_model' (type AttendCopyParseModel):
      • inputs=('SparseTensor(indices=Tensor("inputs:0", shape=(None, 6), dtype=int64), values=Tensor("inputs_1:0", shape=(None,), dtype=float32), dense_shape=Tensor("inputs_2:0", shape=(6,), dtype=int64))', 'tf.Tensor(shape=(4, 128, 128, 3), dtype=float32)', 'tf.Tensor(shape=(4, 128, 128), dtype=int32)', 'tf.Tensor(shape=(4, 128, 128), dtype=int32)', 'tf.Tensor(shape=(4, 128, 128), dtype=int32)', 'tf.Tensor(shape=(4, 128, 128), dtype=float32)', 'tf.Tensor(shape=(4, 128, 128, 4, 2), dtype=float32)')
      • training=True
      • mask=None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions