You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tf.strings.cs 3.1 kB

5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*****************************************************************************
  2. Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ******************************************************************************/
  13. using Tensorflow.Framework;
  14. namespace Tensorflow
  15. {
  16. public partial class tensorflow
  17. {
  18. public StringsApi strings { get; } = new StringsApi();
  19. public class StringsApi
  20. {
  21. string_ops ops = new string_ops();
  22. /// <summary>
  23. /// Converts all uppercase characters into their respective lowercase replacements.
  24. /// </summary>
  25. /// <param name="input"></param>
  26. /// <param name="encoding"></param>
  27. /// <param name="name"></param>
  28. /// <returns></returns>
  29. public Tensor lower(Tensor input, string encoding = "", string name = null)
  30. => ops.lower(input: input, encoding: encoding, name: name);
  31. /// <summary>
  32. ///
  33. /// </summary>
  34. /// <param name="input"></param>
  35. /// <param name="pattern"></param>
  36. /// <param name="rewrite"></param>
  37. /// <param name="replace_global"></param>
  38. /// <param name="name"></param>
  39. /// <returns></returns>
  40. public Tensor regex_replace(Tensor input, string pattern, string rewrite,
  41. bool replace_global = true, string name = null)
  42. => ops.regex_replace(input, pattern, rewrite,
  43. replace_global: replace_global, name: name);
  44. /// <summary>
  45. /// Return substrings from `Tensor` of strings.
  46. /// </summary>
  47. /// <param name="input"></param>
  48. /// <param name="pos"></param>
  49. /// <param name="len"></param>
  50. /// <param name="name"></param>
  51. /// <param name="uint"></param>
  52. /// <returns></returns>
  53. public Tensor substr(Tensor input, int pos, int len,
  54. string name = null, string @uint = "BYTE")
  55. => ops.substr(input, pos, len, @uint: @uint, name: name);
  56. public Tensor substr(string input, int pos, int len,
  57. string name = null, string @uint = "BYTE")
  58. => ops.substr(input, pos, len, @uint: @uint, name: name);
  59. public SparseTensor split(Tensor input, string sep = "", int maxsplit = -1, string name = null)
  60. => ops.string_split_v2(input, sep: sep, maxsplit : maxsplit, name : name);
  61. }
  62. }
  63. }