{"record":{"id":"03063e4b50817155","repo":"tensorflow/models","slug":"expect-input-spec-to-be-4-or-5-dimensions-input-s","errorCode":null,"errorMessage":"Expect input spec to be 4 or 5 dimensions {input_specs.shape}","messagePattern":"Expect input spec to be 4 or 5 dimensions (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"official/projects/assemblenet/modeling/assemblenet.py","lineNumber":809,"sourceCode":"    grouping = {-3: [], -2: [], -1: [], 0: [], 1: [], 2: [], 3: []}\n    for i in range(len(structure)):\n      grouping[structure[i][0]].append(i)\n\n    stem_count = len(grouping[-3]) + len(grouping[-2]) + len(grouping[-1])\n\n    assert stem_count != 0\n    stem_filters = 128 // stem_count\n\n    original_inputs = inputs\n    if len(input_specs.shape) == 5:\n      first_dim = (\n          input_specs.shape[0] * input_specs.shape[1]\n          if input_specs.shape[0] and input_specs.shape[1] else -1)\n      reshape_inputs = tf.reshape(inputs, (first_dim,) + input_specs.shape[2:])\n    elif len(input_specs.shape) == 4:\n      reshape_inputs = original_inputs\n    else:\n      raise ValueError(\n          f'Expect input spec to be 4 or 5 dimensions {input_specs.shape}')\n    if grouping[-2]:\n      # Instead of loading optical flows as inputs from data pipeline, we are\n      # applying the \"Representation Flow\" to RGB frames so that we can compute\n      # the flow within TPU/GPU on fly. It's essentially optical flow since we\n      # do it with RGBs.\n      axis = 3 if data_format == 'channels_last' else 1\n      flow_inputs = rf.RepresentationFlow(\n          original_num_frames,\n          depth=reshape_inputs.shape.as_list()[axis],\n          num_iter=40,\n          bottleneck=1)(\n              reshape_inputs)\n    streams = []\n\n    for i in range(len(structure)):\n      with tf.name_scope('Node_' + str(i)):\n        if structure[i][0] == -1:","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/assemblenet/modeling/assemblenet.py#L791-L827","documentation":"Error \"Expect input spec to be 4 or 5 dimensions {input_specs.shape}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/assemblenet/modeling/assemblenet.py:809 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}