@@ -1104,7 +1104,6 @@ internal func dumpCTensorHandleContent(_ idx: Int, _ inputTensorHandle: CTensorH
1104
1104
}
1105
1105
1106
1106
@inlinable
1107
- @_cdecl ( " _swift_tfc_EagerExecute " )
1108
1107
func _TFCEagerExecute(
1109
1108
_ op: CTFEOp ,
1110
1109
_ retvals: UnsafeMutablePointer < OpaquePointer ? > ,
@@ -1136,25 +1135,19 @@ func _TFCEagerExecute(
1136
1135
//===----------------------------------------------------------------------===//
1137
1136
1138
1137
@usableFromInline
1139
- @_cdecl ( " _swift_tfc_GetGlobalEagerContext " )
1140
1138
func _TFCGetGlobalEagerContext( ) -> CTFEContext {
1141
1139
debugLog ( " Calling _GetGlobalEagerContext() " )
1142
1140
return _ExecutionContext. global. eagerContext
1143
1141
}
1144
1142
1145
- // Some of the functions are marked with @silgen_name instead of @_cdecl, because their input/output
1146
- // data types are not C-compatible (e.g., AnyTensorHandle).
1147
-
1148
1143
/// Adds `handle` as an input to `op`.
1149
1144
@usableFromInline
1150
- @_silgen_name ( " _swift_tfc_OpAddInputFromTensorHandle " )
1151
1145
func _TFCOpAddInputFromTensorHandle( _ op: CTFEOp , _ handle: _AnyTensorHandle , _ status: CTFStatus ) {
1152
1146
TFE_OpAddInput ( op, handle. _cTensorHandle, status)
1153
1147
}
1154
1148
1155
1149
/// Adds `t` as an input or inputs to `op`. Returns the number of inputs added.
1156
1150
@usableFromInline
1157
- @_silgen_name ( " _swift_tfc_OpAddInputFromTensorGroup " )
1158
1151
func _TFCOpAddInputFromTensorGroup< T: TensorArrayProtocol > (
1159
1152
_ op: CTFEOp ,
1160
1153
_ t: T ,
@@ -1187,7 +1180,6 @@ func _TFCOpAddInputFromAnyTensors(_ op: CTFEOp, _ tensors: [AnyTensor], _ status
1187
1180
// can read.
1188
1181
1189
1182
@usableFromInline
1190
- @_silgen_name ( " _swift_tfc_OpSetAttrTypeArray " )
1191
1183
func _TFCOpSetAttrTypeArray(
1192
1184
_ op: CTFEOp ,
1193
1185
_ attrName: UnsafePointer < Int8 > ,
@@ -1201,38 +1193,6 @@ func _TFCOpSetAttrTypeArray(
1201
1193
}
1202
1194
}
1203
1195
1204
- /// Given dimensions and ranks in the form described below, makes the appropriate call to
1205
- /// `TFE_OpSetAttrShapeList(op, attrName, ..., status)`.
1206
- ///
1207
- /// - Parameters
1208
- /// - flattenedDims: all the shapes' dimensions concatenated together in order.
1209
- /// - ranks: all the shapes' ranks (-1 denotes unknown rank).
1210
- fileprivate func setAttrShapeList(
1211
- op: CTFEOp ,
1212
- attrName: UnsafePointer < Int8 > ,
1213
- flattenedDims: Array < Int64 > ,
1214
- ranks: Array < Int32 > ,
1215
- status: CTFStatus
1216
- ) {
1217
- flattenedDims. withUnsafeBufferPointer { flattenedDimsBuffer in
1218
- var dimsPtr : UnsafePointer < Int64 > ? = flattenedDimsBuffer. baseAddress
1219
- var dims : [ UnsafePointer < Int64 > ? ] = [ ]
1220
- for rank in ranks {
1221
- dims. append ( dimsPtr)
1222
- if rank >= 0 {
1223
- dimsPtr = dimsPtr. map { $0. advanced ( by: Int ( rank) ) }
1224
- }
1225
- }
1226
- dims. withUnsafeMutableBufferPointer { dimsBuffer in
1227
- ranks. withUnsafeBufferPointer { ranksBuffer in
1228
- TFE_OpSetAttrShapeList (
1229
- op, attrName, dimsBuffer. baseAddress, ranksBuffer. baseAddress,
1230
- Int32 ( ranksBuffer. count) , status)
1231
- }
1232
- }
1233
- }
1234
- }
1235
-
1236
1196
/// A class to keep around thread local state.
1237
1197
class _ThreadLocalState {
1238
1198
var deviceScopes = DeviceScopes ( )
@@ -1287,7 +1247,6 @@ struct DeviceScopes {
1287
1247
}
1288
1248
1289
1249
@usableFromInline
1290
- @_cdecl ( " _swift_tfc_OpSetDeviceFromScope " )
1291
1250
func _TFCOpSetDeviceFromScope( _ op: CTFEOp , _ status: CTFStatus ) {
1292
1251
if let deviceName = _ExecutionContext. global. currentDeviceName {
1293
1252
TFE_OpSetDevice ( op, deviceName, status)
0 commit comments