Internal change
PiperOrigin-RevId: 521948037
This commit is contained in:
parent
190be2e1bd
commit
7cb8c647ca
|
@ -87,7 +87,7 @@ Status TensorsToDetections(const ::tensorflow::Tensor& num_detections,
|
||||||
const auto& num_boxes_scalar = num_detections.scalar<float>();
|
const auto& num_boxes_scalar = num_detections.scalar<float>();
|
||||||
num_boxes = static_cast<int>(num_boxes_scalar());
|
num_boxes = static_cast<int>(num_boxes_scalar());
|
||||||
} else {
|
} else {
|
||||||
num_boxes = num_detections.scalar<int32>()();
|
num_boxes = num_detections.scalar<int32_t>()();
|
||||||
}
|
}
|
||||||
if (boxes.dim_size(0) < num_boxes) {
|
if (boxes.dim_size(0) < num_boxes) {
|
||||||
return InvalidArgumentError(
|
return InvalidArgumentError(
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace time_series_util {
|
||||||
|
|
||||||
bool LogWarningIfTimestampIsInconsistent(const Timestamp& current_timestamp,
|
bool LogWarningIfTimestampIsInconsistent(const Timestamp& current_timestamp,
|
||||||
const Timestamp& initial_timestamp,
|
const Timestamp& initial_timestamp,
|
||||||
int64 cumulative_samples,
|
int64_t cumulative_samples,
|
||||||
double sample_rate) {
|
double sample_rate) {
|
||||||
// Ignore the "special" timestamp value Done().
|
// Ignore the "special" timestamp value Done().
|
||||||
if (current_timestamp == Timestamp::Done()) return true;
|
if (current_timestamp == Timestamp::Done()) return true;
|
||||||
|
@ -122,11 +122,11 @@ absl::Status IsMatrixShapeConsistentWithHeader(const Matrix& matrix,
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 SecondsToSamples(double time_in_seconds, double sample_rate) {
|
int64_t SecondsToSamples(double time_in_seconds, double sample_rate) {
|
||||||
return round(time_in_seconds * sample_rate);
|
return round(time_in_seconds * sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
double SamplesToSeconds(int64 num_samples, double sample_rate) {
|
double SamplesToSeconds(int64_t num_samples, double sample_rate) {
|
||||||
DCHECK_NE(sample_rate, 0.0);
|
DCHECK_NE(sample_rate, 0.0);
|
||||||
return (num_samples / sample_rate);
|
return (num_samples / sample_rate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ TEST(TimeSeriesUtilTest, SecondsToSamples) {
|
||||||
|
|
||||||
TEST(TimeSeriesUtilTest, SamplesToSeconds) {
|
TEST(TimeSeriesUtilTest, SamplesToSeconds) {
|
||||||
double sample_rate = 32.5;
|
double sample_rate = 32.5;
|
||||||
int64 num_samples = 128;
|
int64_t num_samples = 128;
|
||||||
EXPECT_EQ(num_samples / sample_rate,
|
EXPECT_EQ(num_samples / sample_rate,
|
||||||
SamplesToSeconds(num_samples, sample_rate));
|
SamplesToSeconds(num_samples, sample_rate));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user