diff --git a/src/TensorFlowNET.Core/Attributes/c_api.ops.cs b/src/TensorFlowNET.Core/Attributes/c_api.ops.cs new file mode 100644 index 00000000..9dc36fa8 --- /dev/null +++ b/src/TensorFlowNET.Core/Attributes/c_api.ops.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace Tensorflow +{ + public static partial class c_api + { + /// + /// Fills in `value` with the value of the attribute `attr_name`. `value` must + /// point to an array of length at least `max_length` (ideally set to + /// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, + /// attr_name)). + /// + /// TF_Operation* + /// const char* + /// TF_Status* + /// + [DllImport(TensorFlowLibName)] + public static extern IntPtr TF_OperationGetAttrMetadata(IntPtr oper, string attr_name, IntPtr status); + + /// + /// Fills in `value` with the value of the attribute `attr_name`. `value` must + /// point to an array of length at least `max_length` (ideally set to + /// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, + /// attr_name)). + /// + /// TF_Operation* + /// const char* + /// void* + /// size_t + /// TF_Status* + [DllImport(TensorFlowLibName)] + public static extern void TF_OperationGetAttrString(IntPtr oper, string attr_name, IntPtr value, uint max_length, IntPtr status); + + /// + /// Sets `output_attr_value` to the binary-serialized AttrValue proto + /// representation of the value of the `attr_name` attr of `oper`. + /// + /// + /// + [DllImport(TensorFlowLibName)] + public static extern int TF_OperationGetAttrValueProto(IntPtr oper, string attr_name, IntPtr output_attr_value, IntPtr status); + + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrBool(IntPtr desc, string attr_name, bool value); + + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrValueProto(IntPtr desc, string attr_name, IntPtr proto, uint proto_len, IntPtr status); + + /// + /// Set `num_dims` to -1 to represent "unknown rank". + /// + /// + /// + /// + /// + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrShape(IntPtr desc, string attr_name, long[] dims, int num_dims); + + /// + /// Call some TF_SetAttr*() function for every attr that is not + /// inferred from an input and doesn't have a default value you wish to + /// keep. + /// + /// `value` must point to a string of length `length` bytes. + /// + /// TF_OperationDescription* + /// const char* + /// const void* + /// size_t + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrString(IntPtr desc, string attr_name, IntPtr value, uint length); + + /// + /// + /// + /// + /// + /// + /// + /// + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrStringList(IntPtr desc, string attr_name, IntPtr[] values, uint[] lengths, int num_values); + + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrTensor(IntPtr desc, string attr_name, IntPtr value, IntPtr status); + + [DllImport(TensorFlowLibName)] + public static extern void TF_SetAttrType(IntPtr desc, string attr_name, TF_DataType value); + } +} diff --git a/src/TensorFlowNET.Core/Operations/c_api.ops.cs b/src/TensorFlowNET.Core/Operations/c_api.ops.cs index 462a4321..cb3ae75e 100644 --- a/src/TensorFlowNET.Core/Operations/c_api.ops.cs +++ b/src/TensorFlowNET.Core/Operations/c_api.ops.cs @@ -52,42 +52,6 @@ namespace Tensorflow [DllImport(TensorFlowLibName)] public static extern IntPtr TF_OperationDevice(IntPtr oper); - /// - /// Fills in `value` with the value of the attribute `attr_name`. `value` must - /// point to an array of length at least `max_length` (ideally set to - /// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, - /// attr_name)). - /// - /// TF_Operation* - /// const char* - /// TF_Status* - /// - [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_OperationGetAttrMetadata(IntPtr oper, string attr_name, IntPtr status); - - /// - /// Fills in `value` with the value of the attribute `attr_name`. `value` must - /// point to an array of length at least `max_length` (ideally set to - /// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper, - /// attr_name)). - /// - /// TF_Operation* - /// const char* - /// void* - /// size_t - /// TF_Status* - [DllImport(TensorFlowLibName)] - public static extern void TF_OperationGetAttrString(IntPtr oper, string attr_name, IntPtr value, uint max_length, IntPtr status); - - /// - /// Sets `output_attr_value` to the binary-serialized AttrValue proto - /// representation of the value of the `attr_name` attr of `oper`. - /// - /// - /// - [DllImport(TensorFlowLibName)] - public static extern int TF_OperationGetAttrValueProto(IntPtr oper, string attr_name, IntPtr output_attr_value, IntPtr status); - /// /// Get list of all control inputs to an operation. `control_inputs` must /// point to an array of length `max_control_inputs` (ideally set to @@ -195,52 +159,5 @@ namespace Tensorflow [DllImport(TensorFlowLibName)] public static extern int TF_OperationOutputListLength(IntPtr oper, string arg_name, IntPtr status); - - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrBool(IntPtr desc, string attr_name, bool value); - - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrValueProto(IntPtr desc, string attr_name, IntPtr proto, uint proto_len, IntPtr status); - - /// - /// Set `num_dims` to -1 to represent "unknown rank". - /// - /// - /// - /// - /// - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrShape(IntPtr desc, string attr_name, long[] dims, int num_dims); - - /// - /// Call some TF_SetAttr*() function for every attr that is not - /// inferred from an input and doesn't have a default value you wish to - /// keep. - /// - /// `value` must point to a string of length `length` bytes. - /// - /// TF_OperationDescription* - /// const char* - /// const void* - /// size_t - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrString(IntPtr desc, string attr_name, IntPtr value, uint length); - - /// - /// - /// - /// - /// - /// - /// - /// - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrStringList(IntPtr desc, string attr_name, IntPtr[] values, uint[] lengths, int num_values); - - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrTensor(IntPtr desc, string attr_name, IntPtr value, IntPtr status); - - [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrType(IntPtr desc, string attr_name, TF_DataType value); } }