Skip to content

Commit e1ece66

Browse files
DevNullx64Oceania2018
authored andcommitted
Refactor: remove useless unsafe on tensor implicit cast
1 parent a8288af commit e1ece66

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/TensorFlowNET.Core/Tensors/Tensors.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -90,73 +90,73 @@ public T[] ToArray<T>() where T: unmanaged
9090
}
9191

9292
#region Explicit Conversions
93-
public unsafe static explicit operator bool(Tensors tensor)
93+
public static explicit operator bool(Tensors tensor)
9494
{
9595
EnsureSingleTensor(tensor, "explicit conversion to bool");
9696
return (bool)tensor[0];
9797
}
9898

99-
public unsafe static explicit operator sbyte(Tensors tensor)
99+
public static explicit operator sbyte(Tensors tensor)
100100
{
101101
EnsureSingleTensor(tensor, "explicit conversion to sbyte");
102102
return (sbyte)tensor[0];
103103
}
104104

105-
public unsafe static explicit operator byte(Tensors tensor)
105+
public static explicit operator byte(Tensors tensor)
106106
{
107107
EnsureSingleTensor(tensor, "explicit conversion to byte");
108108
return (byte)tensor[0];
109109
}
110110

111-
public unsafe static explicit operator ushort(Tensors tensor)
111+
public static explicit operator ushort(Tensors tensor)
112112
{
113113
EnsureSingleTensor(tensor, "explicit conversion to ushort");
114114
return (ushort)tensor[0];
115115
}
116116

117-
public unsafe static explicit operator short(Tensors tensor)
117+
public static explicit operator short(Tensors tensor)
118118
{
119119
EnsureSingleTensor(tensor, "explicit conversion to short");
120120
return (short)tensor[0];
121121
}
122122

123-
public unsafe static explicit operator int(Tensors tensor)
123+
public static explicit operator int(Tensors tensor)
124124
{
125125
EnsureSingleTensor(tensor, "explicit conversion to int");
126126
return (int)tensor[0];
127127
}
128128

129-
public unsafe static explicit operator uint(Tensors tensor)
129+
public static explicit operator uint(Tensors tensor)
130130
{
131131
EnsureSingleTensor(tensor, "explicit conversion to uint");
132132
return (uint)tensor[0];
133133
}
134134

135-
public unsafe static explicit operator long(Tensors tensor)
135+
public static explicit operator long(Tensors tensor)
136136
{
137137
EnsureSingleTensor(tensor, "explicit conversion to long");
138138
return (long)tensor[0];
139139
}
140140

141-
public unsafe static explicit operator ulong(Tensors tensor)
141+
public static explicit operator ulong(Tensors tensor)
142142
{
143143
EnsureSingleTensor(tensor, "explicit conversion to ulong");
144144
return (ulong)tensor[0];
145145
}
146146

147-
public unsafe static explicit operator float(Tensors tensor)
147+
public static explicit operator float(Tensors tensor)
148148
{
149149
EnsureSingleTensor(tensor, "explicit conversion to byte");
150150
return (byte)tensor[0];
151151
}
152152

153-
public unsafe static explicit operator double(Tensors tensor)
153+
public static explicit operator double(Tensors tensor)
154154
{
155155
EnsureSingleTensor(tensor, "explicit conversion to double");
156156
return (double)tensor[0];
157157
}
158158

159-
public unsafe static explicit operator string(Tensors tensor)
159+
public static explicit operator string(Tensors tensor)
160160
{
161161
EnsureSingleTensor(tensor, "explicit conversion to string");
162162
return (string)tensor[0];

0 commit comments

Comments
 (0)