foscat.BkTensorflow#

Classes#

Module Contents#

class foscat.BkTensorflow.BkTensorflow(*args, **kwargs)#

Bases: foscat.BkBase.BackendBase

backend#
tf_function#
float64#
float32#
int64#
int32#
complex64#
complex128#
gpulist#
ngpu = 1#
tf_loc_function(func)#
bk_len(S)#
bk_SparseTensor(indice, w, dense_shape=[])#
bk_stack(list, axis=0)#
bk_sparse_dense_matmul(smat, mat)#
periodic_pad(x, pad_height, pad_width)#

Applies periodic (‘wrap’) padding to a 4D TensorFlow tensor (N, H, W, C).

Args: x (tf.Tensor): Input tensor with shape (batch_size, height, width, channels).

pad_height (tuple): Tuple (top, bottom) defining the vertical padding size. pad_width (tuple): Tuple (left, right) defining the horizontal padding size.

Returns:

tf.Tensor: Tensor with periodic padding applied.

binned_mean(data, cell_ids)#

data: Tensor of shape […, N] (float32 or float64) cell_ids: Tensor of shape [N], int indices in [0, n_bins) Returns: mean per bin, shape […, n_bins]

conv2d(x, w)#

Perform 2D convolution using TensorFlow.

Args:

x: Tensor of shape […, Nx, Ny] – input w: Tensor of shape [O_c, wx, wy] – conv weights

Returns:

Tensor of shape […, O_c, Nx, Ny]

conv1d(x, w)#

Perform 1D convolution using TensorFlow.

Args:

x: Tensor of shape […, N] – input w: Tensor of shape [k] – conv weights

Returns:

Tensor of shape […,N]

bk_threshold(x, threshold, greater=True)#
bk_maximum(x1, x2)#
bk_device(device_name)#
bk_ones(shape, dtype=None)#
bk_conv1d(x, w)#
bk_flattenR(x)#
bk_flatten(x)#
bk_resize_image(x, shape)#
bk_L1(x)#
bk_square_comp(x)#
bk_reduce_sum(data, axis=None)#
bk_size(data)#
bk_reduce_mean(data, axis=None)#
bk_reduce_min(data, axis=None)#
bk_random_seed(value)#
bk_random_uniform(shape)#
bk_reduce_std(data, axis=None)#
bk_sqrt(data)#
bk_abs(data)#
bk_is_complex(data)#
bk_distcomp(data)#
bk_norm(data)#
bk_square(data)#
bk_log(data)#
bk_matmul(a, b)#
bk_tensor(data)#
bk_shape_tensor(shape)#
bk_complex(real, imag)#
bk_exp(data)#
bk_min(data)#
bk_argmin(data)#
bk_tanh(data)#
bk_max(data)#
bk_argmax(data)#
bk_reshape(data, shape)#
bk_repeat(data, nn, axis=0)#
bk_tile(data, nn, axis=0)#
bk_roll(data, nn, axis=0)#
bk_expand_dims(data, axis=0)#
bk_transpose(data, thelist)#
bk_concat(data, axis=None)#
bk_zeros(shape, dtype=None)#
bk_gather(data, idx, axis=0)#
bk_reverse(data, axis=0)#
bk_fft(data)#
bk_fftn(data, dim=None)#
bk_ifftn(data, dim=None, norm=None)#
bk_rfft(data)#
bk_irfft(data)#
bk_conjugate(data)#
bk_real(data)#
bk_imag(data)#
bk_relu(x)#
bk_clip_by_value(x, xmin, xmax)#
bk_cast(x)#
bk_variable(x)#
bk_assign(x, y)#
bk_constant(x)#
bk_cos(x)#
bk_sin(x)#
bk_arctan2(c, s)#
bk_empty(list)#
to_numpy(x)#