The third argument to smooth_l1_loss is the size_average, so you would have to specify this argument via beta=1e-2 and beta=0.0, which will then give the same loss output as the initial custom code:
y_pred=torch.tensor(1.0)
y_true=torch.tensor(1.12)

loss1=smooth_l1_loss(y_pred, y_true, beta=1e-2, reduction = 'mean')
loss2=smooth_l1_loss(y_pred, y_true, beta=0, reduction = 'mean')
loss3=l1_loss(y_pred, y_true, reduction = 'mean')
print((y_pred-y_true).abs().item(), loss1.item(), loss2.item(), loss3.item())
> 0.12000000476837158 0.11500000208616257 0.12000000476837158 0.12000000476837158

def l1_loss_smooth(predictions, targets, beta = 1e-2):
    
    loss = 0
    for x, y in zip(predictions, targets):
        if abs(x-y) < beta:
            loss += (0.5*(x-y)**2 / beta).mean()
        else:
            loss += (abs(x-y) - 0.5 * beta).mean()

    loss = loss/predictions.shape[0]
    return loss

output = l1_loss_smooth(y_pred.unsqueeze(0), y_true.unsqueeze(0), beta=1e-2)
print(output)
> tensor(0.1150)

output = l1_loss_smooth(y_pred.unsqueeze(0), y_true.unsqueeze(0), beta=0.0)
print(output)
> tensor(0.1200)