I’ve tried latest jetpack 4.4 Caffe parser to convert my own Caffe model.
But when it comes to broadcast multiplication using caffe’s Scale layer, it will display unsupported error message: “expected 1 bottom blobs, found 2”
What I want to do is simple broadcast multiplication. Ex: feature vector 1x256x1x1 broadcast multiply with feature map 1x256x64x64 (in NCHW order). I’ve also tried avoid using Scale layer with “Tile” layer first to expand the 1x256x1x1 into 1x256x64x64, then we can do element-wise multiplication in same dimensions. But Caffe “Tile” layer seems also not supported by TensorRT too.
Any other ways to overcome this limitation?
Would you mind to give us an example about what exactly broadcast multiplication do?
We want to check if this can be approximated by the current TensorRT.
Here is the list of TensorRT supported operation for your reference first:
Broadcast multiplication is if two tensors’ dimension mismatch, it can automatically repeat the dimension, and do the element-wise multiplication. Like the example I give before:
I have two tensors A & B, need to do element-wise multiplication:
A’s shape = 1x256x1x1
B’s shape = 1x256x64x64
all in NCHW order.
Since the element-wise multiplication need the two tensors in same dimension, the A tensor will be automatically repeat itself to 1x256x64x64. So the element-wise multiply can be done.
The output shape will be 1x256x64x64, after the broadcast multiplication.
Tile layer can be simulated with slice layer.
You can find a similar implementation here:
return activationHelper(ctx, node, inputs, nvinfer1::ActivationType::kTANH);
OnnxAttrs attrs(node, ctx);
float alpha = attrs.get<float>("alpha", 1.f);
return activationHelper(ctx, node, inputs, nvinfer1::ActivationType::kTHRESHOLDED_RELU, &alpha);
// "input : T
// Input tensor of any shape."
nvinfer1::ITensor& input = convertToTensor(inputs.at(0), ctx);
// TRT does not support BOOL input types for this node
ASSERT(input.getType() != nvinfer1::DataType::kBOOL, ErrorCode::kUNSUPPORTED_NODE);
const auto inputDims = shapeOf(input);
// "repeats : T1
// 1D int64 tensor of the same length as input's dimension number,
To give a further support, would you mind to provide the following with us?
source code for feeding input to caffe buffer, deploy and generate the expected output.