|
1 | | -/***************************************************************************** |
| 1 | +/***************************************************************************** |
2 | 2 | Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. |
3 | 3 |
|
4 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -226,6 +226,47 @@ public static Tensor[] tuple(Tensor[] tensors, string name = null, Operation[] c |
226 | 226 | }); |
227 | 227 | } |
228 | 228 |
|
| 229 | + internal static Tensor _case_helper(Func<Tensor, Tensor> cond_fn, Tensor[] pred_fn_pairs, Func<Tensor[]> callable_default, bool exclusive, string name, |
| 230 | + bool allow_python_preds = false) |
| 231 | + { |
| 232 | + /* |
| 233 | + (Tensor[] predicates, Tensor[] actions) = _case_verify_and_canonicalize_args( |
| 234 | + pred_fn_pairs, exclusive, name, allow_python_preds); |
| 235 | + return tf_with(ops.name_scope(name, "case", new [] {predicates}), delegate |
| 236 | + { |
| 237 | + if (callable_default == null) |
| 238 | + { |
| 239 | + (callable_default, predicates, actions) = _case_create_default_action( |
| 240 | + predicates, actions); |
| 241 | + } |
| 242 | + var fn = callable_default; |
| 243 | + }); |
| 244 | + */ |
| 245 | + |
| 246 | + throw new NotImplementedException("_case_helper"); |
| 247 | + } |
| 248 | + |
| 249 | + internal static (Func<Tensor[]>, Tensor[], Tensor[]) _case_create_default_action(Tensor[] predicates, Tensor[] actions) |
| 250 | + { |
| 251 | + throw new NotImplementedException("_case_create_default_action"); |
| 252 | + } |
| 253 | + |
| 254 | + internal static (Tensor[], Tensor[]) _case_verify_and_canonicalize_args(Tensor[] pred_fn_pairs, bool exclusive, string name, bool allow_python_preds) |
| 255 | + { |
| 256 | + throw new NotImplementedException("_case_verify_and_canonicalize_args"); |
| 257 | + } |
| 258 | + |
| 259 | + public static Tensor case_v2(Tensor[] pred_fn_pairs, Func<Tensor[]> callable_default = null, bool exclusive = false, bool strict = false, string name = "case") |
| 260 | + => _case_helper( |
| 261 | + cond_fn: (Tensor x) => cond(x), |
| 262 | + pred_fn_pairs, |
| 263 | + default, |
| 264 | + exclusive, |
| 265 | + name, |
| 266 | + allow_python_preds: false//, |
| 267 | + //strict: strict |
| 268 | + ); |
| 269 | + |
229 | 270 | /// <summary> |
230 | 271 | /// Produces the content of `output_tensor` only after `dependencies`. |
231 | 272 | /// |
|
0 commit comments