@@ -31,8 +31,8 @@ struct deconvolution : public primitive_base<deconvolution> {
31
31
// / @param activation_slp Relu activation slope.
32
32
deconvolution (const primitive_id& id,
33
33
const input_info& input,
34
- const std::vector< primitive_id> & weights,
35
- const std::vector< primitive_id> & bias,
34
+ const primitive_id& weights,
35
+ const primitive_id& bias,
36
36
ov::Strides stride = {1 , 1 },
37
37
ov::CoordinateDiff pad = {0 , 0 },
38
38
ov::Strides dilations = {1 , 1 })
@@ -62,8 +62,8 @@ struct deconvolution : public primitive_base<deconvolution> {
62
62
// / @param activation_slp Relu activation slope.
63
63
deconvolution (const primitive_id& id,
64
64
const input_info& input,
65
- const std::vector< primitive_id> & weights,
66
- const std::vector< primitive_id> & bias,
65
+ const primitive_id& weights,
66
+ const primitive_id& bias,
67
67
uint32_t groups,
68
68
ov::Strides stride = {1 , 1 },
69
69
ov::CoordinateDiff pad = {0 , 0 },
@@ -93,7 +93,7 @@ struct deconvolution : public primitive_base<deconvolution> {
93
93
// / @param activation_slp Relu activation slope.
94
94
deconvolution (const primitive_id& id,
95
95
const input_info& input,
96
- const std::vector< primitive_id> & weights,
96
+ const primitive_id& weights,
97
97
ov::Strides stride = {1 , 1 },
98
98
ov::CoordinateDiff pad = {0 , 0 },
99
99
ov::Strides dilations = {1 , 1 })
@@ -110,7 +110,7 @@ struct deconvolution : public primitive_base<deconvolution> {
110
110
output_partial_shape ({}),
111
111
output_shape_id (" " ),
112
112
weights (weights),
113
- bias (std::vector<primitive_id>( 0 ) ) {}
113
+ bias (" " ) {}
114
114
115
115
// / @brief Constructs deconvolution primitive (w/o bias).
116
116
// / @param id This primitive id.
@@ -123,7 +123,7 @@ struct deconvolution : public primitive_base<deconvolution> {
123
123
// / @param activation_slp Relu activation slope.
124
124
deconvolution (const primitive_id& id,
125
125
const input_info& input,
126
- const std::vector< primitive_id> & weights,
126
+ const primitive_id& weights,
127
127
uint32_t groups,
128
128
ov::Strides stride = {1 , 1 },
129
129
ov::CoordinateDiff pad = {0 , 0 },
@@ -141,7 +141,7 @@ struct deconvolution : public primitive_base<deconvolution> {
141
141
output_partial_shape ({}),
142
142
output_shape_id (" " ),
143
143
weights (weights),
144
- bias (std::vector<primitive_id>( 0 ) ) {}
144
+ bias (" " ) {}
145
145
146
146
// / @brief Constructs deconvolution primitive (computes input paddings to match output size).
147
147
// / @param id This primitive id.
@@ -155,8 +155,8 @@ struct deconvolution : public primitive_base<deconvolution> {
155
155
// / @param output_size User-defined output data size of the primitive (w/o padding).
156
156
deconvolution (const primitive_id& id,
157
157
const input_info& input,
158
- const std::vector< primitive_id> & weights,
159
- const std::vector< primitive_id> & bias,
158
+ const primitive_id& weights,
159
+ const primitive_id& bias,
160
160
ov::Strides stride,
161
161
ov::CoordinateDiff pad,
162
162
ov::Strides dilations,
@@ -190,8 +190,8 @@ struct deconvolution : public primitive_base<deconvolution> {
190
190
// / @param output_size User-defined output data size of the primitive (w/o padding).
191
191
deconvolution (const primitive_id& id,
192
192
const input_info& input,
193
- const std::vector< primitive_id> & weights,
194
- const std::vector< primitive_id> & bias,
193
+ const primitive_id& weights,
194
+ const primitive_id& bias,
195
195
uint32_t groups,
196
196
ov::Strides stride,
197
197
ov::CoordinateDiff pad,
@@ -227,8 +227,8 @@ struct deconvolution : public primitive_base<deconvolution> {
227
227
// / @param output_size User-defined output data size of the primitive (w/o padding).
228
228
deconvolution (const primitive_id& id,
229
229
const input_info& input,
230
- const std::vector< primitive_id> & weights,
231
- const std::vector< primitive_id> & bias,
230
+ const primitive_id& weights,
231
+ const primitive_id& bias,
232
232
uint32_t groups,
233
233
ov::Strides stride,
234
234
ov::CoordinateDiff pad,
@@ -263,7 +263,7 @@ struct deconvolution : public primitive_base<deconvolution> {
263
263
// / @param output_size User-defined output data size of the primitive (w/o padding).
264
264
deconvolution (const primitive_id& id,
265
265
const input_info& input,
266
- const std::vector< primitive_id> & weights,
266
+ const primitive_id& weights,
267
267
ov::Strides stride,
268
268
ov::CoordinateDiff pad,
269
269
ov::Strides dilations,
@@ -280,7 +280,7 @@ struct deconvolution : public primitive_base<deconvolution> {
280
280
out_padding (pad.size(), 0 ),
281
281
grouped_weights_shape (false ),
282
282
weights (weights),
283
- bias (std::vector<primitive_id>( 0 ) ) {}
283
+ bias (" " ) {}
284
284
285
285
// / @brief Constructs deconvolution primitive (computes input paddings to match output size).
286
286
// / @param id This primitive id.
@@ -295,8 +295,8 @@ struct deconvolution : public primitive_base<deconvolution> {
295
295
// / @return Deconvolution primitive with specified settings.
296
296
static deconvolution create_with_output_size (const primitive_id& id,
297
297
const input_info& input,
298
- const std::vector< primitive_id> & weights,
299
- const std::vector< primitive_id> & bias,
298
+ const primitive_id& weights,
299
+ const primitive_id& bias,
300
300
tensor output_size,
301
301
ov::Strides stride = {1 , 1 },
302
302
ov::CoordinateDiff pad = {0 , 0 },
@@ -323,7 +323,7 @@ struct deconvolution : public primitive_base<deconvolution> {
323
323
// / @return Deconvolution primitive with specified settings.
324
324
static deconvolution create_with_output_size (const primitive_id& id,
325
325
const input_info& input,
326
- const std::vector< primitive_id> & weights,
326
+ const primitive_id& weights,
327
327
tensor output_size,
328
328
ov::Strides stride = {1 , 1 },
329
329
ov::CoordinateDiff pad = {0 , 0 },
@@ -360,21 +360,21 @@ struct deconvolution : public primitive_base<deconvolution> {
360
360
// / @brief Defines spatial shape of the output.
361
361
ov::PartialShape output_partial_shape;
362
362
// / @brief Data primitive id containing spatial shape of the output.
363
- primitive_id output_shape_id;
363
+ input_info output_shape_id;
364
364
// / @brief List of primitive ids containing weights data.
365
- const primitive_id_arr weights;
365
+ input_info weights;
366
366
// / @brief List of primitive ids containing bias data.
367
- const primitive_id_arr bias;
367
+ input_info bias;
368
368
369
369
size_t hash () const override {
370
370
size_t seed = primitive::hash ();
371
371
seed = hash_range (seed, pad.begin (), pad.end ());
372
372
seed = hash_range (seed, stride.begin (), stride.end ());
373
373
seed = hash_combine (seed, groups);
374
374
seed = hash_combine (seed, grouped_weights_shape);
375
- seed = hash_combine (seed, weights.size ());
376
- seed = hash_combine (seed, bias.size ());
377
- seed = hash_combine (seed, output_shape_id.empty ());
375
+ seed = hash_combine (seed, weights.is_valid ());
376
+ seed = hash_combine (seed, bias.is_valid ());
377
+ seed = hash_combine (seed, output_shape_id.is_valid ());
378
378
return seed;
379
379
}
380
380
@@ -393,9 +393,9 @@ struct deconvolution : public primitive_base<deconvolution> {
393
393
cmp_fields (pads_end) &&
394
394
cmp_fields (out_padding) &&
395
395
cmp_fields (grouped_weights_shape) &&
396
- cmp_fields (weights.size ()) &&
397
- cmp_fields (bias.size ()) &&
398
- cmp_fields (output_shape_id.empty ());
396
+ cmp_fields (weights.is_valid ()) &&
397
+ cmp_fields (bias.is_valid ()) &&
398
+ cmp_fields (output_shape_id.is_valid ());
399
399
#undef cmp_fields
400
400
}
401
401
@@ -431,17 +431,23 @@ struct deconvolution : public primitive_base<deconvolution> {
431
431
ib >> grouped_weights_shape;
432
432
ib >> output_partial_shape;
433
433
ib >> output_shape_id;
434
- ib >> * const_cast <primitive_id_arr*>(& weights) ;
435
- ib >> * const_cast <primitive_id_arr*>(& bias) ;
434
+ ib >> weights;
435
+ ib >> bias;
436
436
}
437
437
438
438
protected:
439
- std::vector<input_info> get_dependencies () const override {
440
- std::vector<input_info> ret;
441
- ret.reserve (weights.size () + bias.size () + (output_shape_id.empty () ? 0 : 1 ));
442
- for (auto & w : weights) ret.push_back (w);
443
- for (auto & b : bias) ret.push_back (b);
444
- if (!output_shape_id.empty ()) ret.push_back (output_shape_id);
439
+ std::map<size_t , const input_info*> get_dependencies_map () const override {
440
+ auto ret = std::map<size_t , const input_info*>{};
441
+ auto idx = input.size ();
442
+
443
+ OPENVINO_ASSERT (weights.is_valid ());
444
+ ret[idx++] = &weights;
445
+
446
+ if (bias.is_valid ())
447
+ ret[idx++] = &bias;
448
+
449
+ if (output_shape_id.is_valid ())
450
+ ret[idx++] = &output_shape_id;
445
451
446
452
return ret;
447
453
}
0 commit comments