mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-22 13:08:09 +02:00
teflon: Add support for FullyConnected
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32510>
This commit is contained in:
parent
3e74234450
commit
3d8f108514
2 changed files with 30 additions and 0 deletions
|
|
@ -171,6 +171,12 @@ fill_operation(struct teflon_delegate *delegate, TfLiteContext *tf_context, TfLi
|
|||
operation->pad.after_y = paddings[5];
|
||||
break;
|
||||
}
|
||||
case kTfLiteBuiltinFullyConnected: {
|
||||
operation->type = PIPE_ML_OPERATION_TYPE_FULLY_CONNECTED;
|
||||
operation->fcon.weight_tensor = &tensors[node->inputs->data[1]];
|
||||
operation->fcon.bias_tensor = &tensors[node->inputs->data[2]];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
unreachable("Unsupported ML operation type");
|
||||
}
|
||||
|
|
@ -252,6 +258,9 @@ dump_graph(struct pipe_tensor *tensors, unsigned tensor_count, struct pipe_ml_op
|
|||
case PIPE_ML_OPERATION_TYPE_PAD:
|
||||
teflon_debug("%-6s ", "PAD");
|
||||
break;
|
||||
case PIPE_ML_OPERATION_TYPE_FULLY_CONNECTED:
|
||||
teflon_debug("%-6s ", "FCON");
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned j = 0; j < operations[i].input_count; j++) {
|
||||
|
|
@ -585,6 +594,9 @@ PrepareDelegate(TfLiteContext *context, TfLiteDelegate *delegate)
|
|||
padding[7] == 0;
|
||||
break;
|
||||
}
|
||||
case kTfLiteBuiltinFullyConnected:
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (supported)
|
||||
|
|
|
|||
|
|
@ -1062,6 +1062,7 @@ enum pipe_ml_operation_type {
|
|||
PIPE_ML_OPERATION_TYPE_CONCATENATION,
|
||||
PIPE_ML_OPERATION_TYPE_SPLIT,
|
||||
PIPE_ML_OPERATION_TYPE_PAD,
|
||||
PIPE_ML_OPERATION_TYPE_FULLY_CONNECTED,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1092,6 +1093,7 @@ struct pipe_ml_operation
|
|||
* For convolutions, tensor containing the weights.
|
||||
*/
|
||||
struct pipe_tensor *weight_tensor;
|
||||
|
||||
/**
|
||||
* For convolutions, tensor containing the biases.
|
||||
*/
|
||||
|
|
@ -1173,6 +1175,22 @@ struct pipe_ml_operation
|
|||
*/
|
||||
unsigned after_y;
|
||||
} pad;
|
||||
|
||||
struct {
|
||||
/**
|
||||
* Tensor containing the weights.
|
||||
*/
|
||||
struct pipe_tensor *weight_tensor;
|
||||
/**
|
||||
* Tensor containing the biases.
|
||||
*/
|
||||
struct pipe_tensor *bias_tensor;
|
||||
|
||||
/**
|
||||
* Whether a ReLU activation should be applied to the output.
|
||||
*/
|
||||
bool relu;
|
||||
} fcon;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue