xmartlabs/Bender

Cannot create ConcatV2. Missing or invalid attribute axis

silppuri opened this issue · 2 comments

I get the following error when converting the graph containing a concat node with axis int_value greater than 2.

fatal error: Cannot create ConcatV2. Missing or invalid attribute axis.: file <omited>/Pods/MetalBender/Sources/Adapters/Tensorflow/TFConverter+Mappers.swift, line 162

And the node in question from the .pbtxt:

node {
  name: "fire2/concat/concat/axis"
  op: "Const"
  attr {
    key: "dtype"
    value {
      type: DT_INT32
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_INT32
        tensor_shape {
        }
        int_val: 3
      }
    }
  }
}

And if I follow correctly the code it executes the LayerConverter+Mappers.swift calls the LayerSize.fromTf with the value 3. which in return is as follow:

    static func fromTF(index: Int) -> LayerSizeAxis? {
        switch index {
        case 0:
            return .w
        case 1:
            return .h
        case 2:
            return .f
        default:
            return nil
        }
    }
}

This evaluates as nil and throws an error.

Is there an error with the graph I'm trying to convert or is a bug in the Bender that it does not support concat indexes beyond axis=2 on a concat layer?

Environment:

  • Xcode 8.3.3,
  • iOS: 10.3.2,
  • SDK version: 10.3

Bender, as it's based on MPSImage, doesn't support tensors with more than 3 dimensions. What is the shape of the input tensor of the concat?

Ah ok good to know! I'm totally new to the iOS development and tipping my toes around to see what fits my project and Bender seems to be a nice API for the iOS ML projects.
Are there any "hacks" to bypass the limitation of three dimensions?

The tensors to be concatenated have shapes like [64,63,128,64] and [128,63,128,64]. This is an inception fire module I'm trying to implement. (An example is of the concat operation )