@@ -59,18 +59,40 @@ class StaticShape {
59
59
height_, width_, depth_, loss_type_);
60
60
}
61
61
62
+ bool DeSerialize (TFile *fp) {
63
+ int32_t tmp;
64
+ bool result =
65
+ fp->FReadEndian (&batch_, sizeof (batch_), 1 ) == 1 &&
66
+ fp->FReadEndian (&height_, sizeof (height_), 1 ) == 1 &&
67
+ fp->FReadEndian (&width_, sizeof (width_), 1 ) == 1 &&
68
+ fp->FReadEndian (&depth_, sizeof (depth_), 1 ) == 1 &&
69
+ fp->FReadEndian (&tmp, sizeof (tmp), 1 ) == 1 ;
70
+ loss_type_ = static_cast <LossType>(tmp);
71
+ return result;
72
+ }
73
+
74
+ bool Serialize (TFile *fp) const {
75
+ int32_t tmp = loss_type_;
76
+ return
77
+ fp->FWrite (&batch_, sizeof (batch_), 1 ) == 1 &&
78
+ fp->FWrite (&height_, sizeof (height_), 1 ) == 1 &&
79
+ fp->FWrite (&width_, sizeof (width_), 1 ) == 1 &&
80
+ fp->FWrite (&depth_, sizeof (depth_), 1 ) == 1 &&
81
+ fp->FWrite (&tmp, sizeof (tmp), 1 ) == 1 ;
82
+ }
83
+
62
84
private:
63
85
// Size of the 4-D tensor input/output to a network. A value of zero is
64
86
// allowed for all except depth_ and means to be determined at runtime, and
65
87
// regarded as variable.
66
88
// Number of elements in a batch, or number of frames in a video stream.
67
- int batch_;
89
+ int32_t batch_;
68
90
// Height of the image.
69
- int height_;
91
+ int32_t height_;
70
92
// Width of the image.
71
- int width_;
93
+ int32_t width_;
72
94
// Depth of the image. (Number of "nodes").
73
- int depth_;
95
+ int32_t depth_;
74
96
// How to train/interpret the output.
75
97
LossType loss_type_;
76
98
};
0 commit comments