38 lines
1.5 KiB
Diff
38 lines
1.5 KiB
Diff
|
|
From 799f835a3dfa00a4d852defa29b15841eea9d64f Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mihai Maruseac <mihaimaruseac@google.com>
|
||
|
|
Date: Mon, 19 Apr 2021 09:56:46 -0700
|
||
|
|
Subject: [PATCH] Fix 2 issues with `Conv3D`.
|
||
|
|
|
||
|
|
---
|
||
|
|
tensorflow/core/kernels/conv_ops_3d.cc | 7 +++++++
|
||
|
|
1 file changed, 7 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/tensorflow/core/kernels/conv_ops_3d.cc b/tensorflow/core/kernels/conv_ops_3d.cc
|
||
|
|
index 52356443..75a0a043 100644
|
||
|
|
--- a/tensorflow/core/kernels/conv_ops_3d.cc
|
||
|
|
+++ b/tensorflow/core/kernels/conv_ops_3d.cc
|
||
|
|
@@ -68,6 +68,11 @@ struct LaunchConvOp<CPUDevice, T> {
|
||
|
|
errors::InvalidArgument("CPU implementation of Conv3D "
|
||
|
|
"currently only supports dilated rates "
|
||
|
|
"of 1."));
|
||
|
|
+ OP_REQUIRES(context, filter.dim_size(3) == input.dim_size(input.dims() - 1),
|
||
|
|
+ errors::InvalidArgument(
|
||
|
|
+ "Number of channels in filter (", filter.dim_size(3),
|
||
|
|
+ ") must match last dimension of input (",
|
||
|
|
+ input.dim_size(input.dims() - 1), ")"));
|
||
|
|
functor::CuboidConvolution<CPUDevice, T>()(
|
||
|
|
context->eigen_device<CPUDevice>(), output->tensor<T, 5>(),
|
||
|
|
input.tensor<T, 5>(), filter.tensor<T, 5>(), strides[2], strides[1],
|
||
|
|
@@ -141,6 +146,8 @@ class Conv3DOp : public BinaryOp<T> {
|
||
|
|
const int64 filter_depth = filter.dim_size(3);
|
||
|
|
const int64 out_depth = filter.dim_size(4);
|
||
|
|
|
||
|
|
+ OP_REQUIRES(context, filter_depth != 0,
|
||
|
|
+ errors::InvalidArgument("filter_depth must be non-zero"));
|
||
|
|
OP_REQUIRES(context, in_depth % filter_depth == 0,
|
||
|
|
errors::InvalidArgument(
|
||
|
|
"Input depth must be evenly divisible by filter depth: ",
|
||
|
|
--
|
||
|
|
2.23.0
|
||
|
|
|