| 27 | using shape_inference::ShapeHandle; |
| 28 | |
| 29 | Status DecodeWavShapeFn(InferenceContext* c) { |
| 30 | ShapeHandle unused; |
| 31 | TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 0, &unused)); |
| 32 | |
| 33 | DimensionHandle channels_dim; |
| 34 | int32 desired_channels; |
| 35 | TF_RETURN_IF_ERROR(c->GetAttr("desired_channels", &desired_channels)); |
| 36 | if (desired_channels == -1) { |
| 37 | channels_dim = c->UnknownDim(); |
| 38 | } else { |
| 39 | if (desired_channels < 0) { |
| 40 | return errors::InvalidArgument("channels must be non-negative, got ", |
| 41 | desired_channels); |
| 42 | } |
| 43 | channels_dim = c->MakeDim(desired_channels); |
| 44 | } |
| 45 | DimensionHandle samples_dim; |
| 46 | int32 desired_samples; |
| 47 | TF_RETURN_IF_ERROR(c->GetAttr("desired_samples", &desired_samples)); |
| 48 | if (desired_samples == -1) { |
| 49 | samples_dim = c->UnknownDim(); |
| 50 | } else { |
| 51 | if (desired_samples < 0) { |
| 52 | return errors::InvalidArgument("samples must be non-negative, got ", |
| 53 | desired_samples); |
| 54 | } |
| 55 | samples_dim = c->MakeDim(desired_samples); |
| 56 | } |
| 57 | c->set_output(0, c->MakeShape({samples_dim, channels_dim})); |
| 58 | c->set_output(1, c->Scalar()); |
| 59 | return Status::OK(); |
| 60 | } |
| 61 | |
| 62 | Status EncodeWavShapeFn(InferenceContext* c) { |
| 63 | ShapeHandle unused; |
nothing calls this directly
no test coverage detected